[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] switch from sprintf to asprintf and snprintf
From: |
Colin Watson |
Subject: |
Re: [PATCH] switch from sprintf to asprintf and snprintf |
Date: |
Fri, 1 Jan 2010 12:01:06 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Fri, Jan 01, 2010 at 12:52:56PM +0100, Robert Millan wrote:
> On Fri, Jan 01, 2010 at 09:32:24AM +0000, Colin Watson wrote:
> > On Tue, Dec 29, 2009 at 10:30:12AM +0100, Vladimir 'φ-coder/phcoder'
> > Serbinenko wrote:
> > > +char *EXPORT_FUNC(grub_asprintf) (const char *fmt, ...)
> > > + __attribute__ ((format (printf, 1, 2)));
> >
> > It's very confusing that you've made grub_asprintf have a dramatically
> > different interface from asprintf. Perhaps you could call this
> > grub_xasprintf instead?
>
> Is it feasible to implement the same interface as asprintf instead?
asprintf is not really the ideal interface; most people forget to handle
errors when using it, and it's verbose even when used well. If there's a
single approach to out-of-memory errors that's appropriate throughout,
then something like xasprintf is much better.
--
Colin Watson address@hidden
Re: [PATCH] switch from sprintf to asprintf and snprintf, Vladimir 'φ-coder/phcoder' Serbinenko, 2010/01/17