From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NQfrO-0006n9-VZ for mharc-grub-devel@gnu.org; Fri, 01 Jan 2010 06:40:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQfrN-0006m9-FY for grub-devel@gnu.org; Fri, 01 Jan 2010 06:40:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQfrI-0006iz-8X for grub-devel@gnu.org; Fri, 01 Jan 2010 06:40:00 -0500 Received: from [199.232.76.173] (port=35822 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQfrI-0006iw-2f for grub-devel@gnu.org; Fri, 01 Jan 2010 06:39:56 -0500 Received: from xvm-190-8.ghst.net ([217.70.190.8]:42654 helo=aybabtu.com) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQfrH-0004na-H4 for grub-devel@gnu.org; Fri, 01 Jan 2010 06:39:55 -0500 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtp (Exim 4.69) (envelope-from ) id 1NQfrF-0005nS-SG for grub-devel@gnu.org; Fri, 01 Jan 2010 12:39:54 +0100 Received: from rmh by thorin with local (Exim 4.69) (envelope-from ) id 1NQfrF-00016j-BI for grub-devel@gnu.org; Fri, 01 Jan 2010 12:39:53 +0100 Date: Fri, 1 Jan 2010 12:39:53 +0100 From: Robert Millan To: The development of GNU GRUB Message-ID: <20100101113953.GC3692@thorin> References: <4B37B094.7040102@labri.fr> <4B395C02.9060500@labri.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4B395C02.9060500@labri.fr> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.18 (2008-05-17) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: [PATCH] grub-probe support for NetBSD X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2010 11:40:01 -0000 On Tue, Dec 29, 2009 at 02:31:46AM +0100, Grégoire Sutre wrote: > +#if defined(__NetBSD__) > + /* Convert this block device to its character (raw) device */ > + res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 3); > + sprintf (res, "%s/r%s", cwd, ent->d_name); > +#else > res = xmalloc (strlen (cwd) + strlen (ent->d_name) + 2); > sprintf (res, "%s/%s", cwd, ent->d_name); > +#endif Can you avoid code duplication here? Something like: #ifdef __NetBSD__ const char *template = "%s/r%s"; #else const char *template = "%s/%s"; #endif -- Robert Millan "Be the change you want to see in the world" -- Gandhi