From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NR2HS-0006MC-HX for mharc-grub-devel@gnu.org; Sat, 02 Jan 2010 06:36:26 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NR2HO-0006GJ-Np for grub-devel@gnu.org; Sat, 02 Jan 2010 06:36:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NR2HK-0006CU-TX for grub-devel@gnu.org; Sat, 02 Jan 2010 06:36:22 -0500 Received: from [199.232.76.173] (port=57172 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NR2HK-0006CE-QG for grub-devel@gnu.org; Sat, 02 Jan 2010 06:36:18 -0500 Received: from mx20.gnu.org ([199.232.41.8]:15853) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NR2HH-00077d-1V for grub-devel@gnu.org; Sat, 02 Jan 2010 06:36:18 -0500 Received: from iona.labri.fr ([147.210.8.143]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NR2Gs-0005S6-Lr for grub-devel@gnu.org; Sat, 02 Jan 2010 06:35:50 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by iona.labri.fr (Postfix) with ESMTP id DAADA36B6F for ; Sat, 2 Jan 2010 12:35:44 +0100 (CET) X-Virus-Scanned: amavisd-new at labri.fr Received: from iona.labri.fr ([127.0.0.1]) by localhost (iona.labri.fr [127.0.0.1]) (amavisd-new, port 10027) with LMTP id qBEkI5CWVfW8 for ; Sat, 2 Jan 2010 12:35:44 +0100 (CET) Received: from [192.168.1.50] (c2433-1-88-160-112-182.fbx.proxad.net [88.160.112.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by iona.labri.fr (Postfix) with ESMTP id ACB1C36B6D for ; Sat, 2 Jan 2010 12:35:44 +0100 (CET) Message-ID: <4B3F2F90.2020308@labri.fr> Date: Sat, 02 Jan 2010 12:35:44 +0100 From: =?UTF-8?B?R3LDqWdvaXJlIFN1dHJl?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: The development of GNU GRUB References: <4B37B094.7040102@labri.fr> <4B395C02.9060500@labri.fr> <20100101113953.GC3692@thorin> In-Reply-To: <20100101113953.GC3692@thorin> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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: Sat, 02 Jan 2010 11:36:23 -0000 Robert Millan wrote: > On Tue, Dec 29, 2009 at 02:31:46AM +0100, Gr=C3=A9goire Sutre wrote: >> +#if defined(__NetBSD__) >> + /* Convert this block device to its character (raw) device */ >> + res =3D xmalloc (strlen (cwd) + strlen (ent->d_name) + 3); >> + sprintf (res, "%s/r%s", cwd, ent->d_name); >> +#else >> res =3D xmalloc (strlen (cwd) + strlen (ent->d_name) + 2); >> sprintf (res, "%s/%s", cwd, ent->d_name); >> +#endif >=20 > Can you avoid code duplication here? Something like: >=20 > #ifdef __NetBSD__ > const char *template =3D "%s/r%s"; > #else > const char *template =3D "%s/%s"; > #endif Indeed, it's better. But we also need a variable for the extra length=20 (3 for NetBSD and 2 otherwise). I have updated the patch. http://pkgsrc-wip.cvs.sourceforge.net/viewvc/*checkout*/pkgsrc-wip/wip/gr= ub2-current/patches/patch-grub-probe-netbsd The patch is not finished yet: as discussed on IRC, I'll try to=20 factorize Linux and NetBSD code in grub_util_biosdisk_get_grub_dev, and=20 to fix the floppy problem. Gr=C3=A9goire