INN commit: trunk (6 files)

Julien ÉLIE julien at
Fri Aug 10 08:01:14 UTC 2007

En réponse à Russ Allbery :
>> Use (v)asprintf instead of (v)snprintf.
> Oh, sorry, looking at this, I realize that I gave you bad information.
> asprintf itself will return NULL on failure to allocate memory.

It's not your fault;  I should have been more careful when I changed
snprintf/*x*malloc to asprintf.  Besides, I looked at the code of lib/asprintf.c
and wondered why it called malloc inside (and not xmalloc).  I have now
the answer :)

I also knew that paragraph in HACKING:
"Another frequently included header file is F<inn/libinn.h>, which among other
things defines xmalloc(), xrealloc(), xstrdup(), and xcalloc(), which are
checked versions of the standard memory allocation routines that terminate
the program if the memory allocation fails.  These should generally always
be used instead of the regular C versions."

But I did not have a glance at libinn.h;  it is now done!

> To duplicate the automatic checking of xmalloc, you want to use xasprintf or
> xvasprintf here instead.

Thanks.  Fixed.

Julien ÉLIE

« -- On nage dans le lac, on escalade les montagnes...
  -- Ben quoi ? Nous ne sommes pas en vacances ! » (Astérix) 

More information about the inn-workers mailing list