All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] grub-probe support for NetBSD
Date: Sat, 02 Jan 2010 12:40:00 +0100	[thread overview]
Message-ID: <4B3F3090.9090706@gmail.com> (raw)
In-Reply-To: <4B3F2F90.2020308@labri.fr>

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

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
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

  reply	other threads:[~2010-01-02 11:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-27 19:08 [PATCH] grub-probe support for NetBSD Grégoire Sutre
2009-12-29  1:31 ` Grégoire Sutre
2010-01-01 11:39   ` Robert Millan
2010-01-02 11:35     ` Grégoire Sutre
2010-01-02 11:40       ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2010-01-02 11:46         ` Grégoire Sutre
2010-01-03 16:27       ` Robert Millan
2010-01-04  1:32 ` Grégoire Sutre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B3F3090.9090706@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.