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

Re: [Xen-devel] [PATCH v6 5/9] Add an implentation of asprintf() for xen



> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: 08 May 2014 15:57
> To: Paul Durrant
> Cc: Ian Campbell; Ian Jackson; xen-devel@xxxxxxxxxxxxx; Keir (Xen.org); Tim
> (Xen.org)
> Subject: Re: [PATCH v6 5/9] Add an implentation of asprintf() for xen
> 
> >>> On 08.05.14 at 15:23, <paul.durrant@xxxxxxxxxx> wrote:
> > +int vasprintf(char **bufp, const char *fmt, va_list args)
> > +{
> > +    va_list args_copy;
> > +    size_t size;
> > +    char *buf, dummy[1];
> > +
> > +    va_copy(args_copy, args);
> > +    size = vsnprintf(dummy, 0, fmt, args_copy);
> 
> Is there a reason for the first argument not simply being NULL?
> 

I was nervous about whether vsnprintf's pointer arithmetic would DTRT in the 
case of NULL.

  Paul

> Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.