grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] grub-probe support for NetBSD


From: Robert Millan
Subject: Re: [PATCH] grub-probe support for NetBSD
Date: Fri, 1 Jan 2010 12:39:53 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]