From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: Re: [PATCH 3/4] gnu: libcanberra: Add propagated-input. Date: Sun, 11 Jan 2015 09:34:38 +0100 Message-ID: References: <87oaqxqn2h.fsf@gnu.org> <87zj9uz6z2.fsf@gnu.org> <87y4pd57o9.fsf@gnu.org> <87fvbifiej.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YADyq-00068R-57 for guix-devel@gnu.org; Sun, 11 Jan 2015 03:34:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YADyp-0003Rp-5J for guix-devel@gnu.org; Sun, 11 Jan 2015 03:34:40 -0500 In-Reply-To: <87fvbifiej.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: Guix-devel On Sat, Jan 10, 2015 at 10:13 PM, Ludovic Court=C3=A8s wrote= : > Very good! Could you add the story about XDG_DATA_DIRS > vs. XDG_DATA_HOME as a comment above the phase? Will do. > >> + (let ((sounds (string-append >> + (assoc-ref inputs "sound-theme-freedesktop") >> + "/share"))) >> + (substitute* "src/sound-theme-spec.c" >> + (("return \"/usr/local/share:/usr/share\";") >> + (string-append "return \"" sounds "\";\n" >> + " else {\n" >> + " const char *stp =3D \":" >> + sounds "\";\n" >> + " size_t len =3D strlen(s= tp) + " >> + "strlen(g) + 1;\n" >> + " " >> + "char *g2 =3D (char*) malloc(len);\n" >> + " return " >> + "strcat(strcpy(g2, g), stp);\n" >> + " }"))))) > > Why not just: > > (string-append "return \"" sounds "\";") > > ? The first "return" is used in an "if" clause that checks that XDG_DATA_DIRS is either empty, or not defined. The variable "g" is a pointer to a string contains the value of XDG_DATA_DIRS. I'm adding an "else" with a second "return" to add the sounds directory even when XDG_DATA_DIRS is defined (the unpatched program does returns "g" in this case and therefore the sounds would not be found). Regards, Fede