[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] grub-probe support for NetBSD
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [PATCH] grub-probe support for NetBSD |
Date: |
Sat, 02 Jan 2010 12:40:00 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20091109) |
Grégoire Sutre wrote:
> Robert Millan wrote:
>> 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
>
> Indeed, it's better. But we also need a variable for the extra length
> (3 for NetBSD and 2 otherwise).
One byte is cheap. No need for gimmicks just to save one byte. You can
always allocate with +3
> I have updated the patch.
>
> http://pkgsrc-wip.cvs.sourceforge.net/viewvc/*checkout*/pkgsrc-wip/wip/grub2-current/patches/patch-grub-probe-netbsd
>
>
> The patch is not finished yet: as discussed on IRC, I'll try to
> factorize Linux and NetBSD code in grub_util_biosdisk_get_grub_dev,
> and to fix the floppy problem.
>
> Grégoire
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
signature.asc
Description: OpenPGP digital signature