[haiku-commits] Re: r40695 - haiku/trunk/src/kits/support

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 27 Feb 2011 07:14:44 +0100

jonas@xxxxxxxxxxx wrote:
> +BString&
> +BString::SetToArguments(const char *format, ...)
> +{
> +     va_list arg;
> +     va_start(arg, format);
> +     int32 bytes = vsnprintf(LockBuffer(0), 0, format, arg);
> +     va_end(arg);
> +     UnlockBuffer(0);

Why LockBuffer() here? It's not like you need any kind of buffer here.
Also, it would be cheaper to have it run once into an on stack buffer, 
and only run it a second time if that buffer was too small.

And in r40697:
>                       BString&                AdoptChars(BString& from, int32 
> charCount);
> +                     
> +                     BString&                SetToArguments(const char 
> *format, ...);

What the asterisk style - it's not consistent with the rest of the 
file.

Bye,
   Axel.


Other related posts: