bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] Re: snprintf


From: Bruno Haible
Subject: Re: [Bug-gnulib] Re: snprintf
Date: Fri, 1 Oct 2004 12:24:32 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> in some places, I feel snprintf is useful, consider:
> 
>     char keyid[16];
>     unsigned int kid[2];
> ...
>     snprintf(keyid, 16, "%08lX%08lX", kid[0], kid[1]);

OK, agreed.

> And with the patch below it might even compile...

I've committed a similar patch. Still there are two issues:

 - What if size == 0 ?

 - Why do you let vasnprintf allocate the entire string if, afterwards,
   you only need size bytes of it? You could already tell vasnprintf
   to produce less memory.

Bruno





reply via email to

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