[haiku-commits] Re: r36659 - haiku/trunk/src/apps/stylededit

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 06 May 2010 18:32:19 +0200

On 2010-05-06 at 18:12:35 [+0200], Stephan Assmus <superstippi@xxxxxx> wrote:
> 
> On 2010-05-06 at 17:47:55 [+0200], axeld@xxxxxxxxxxxxxxxx wrote:
> > Author: axeld
> > Date: 2010-05-06 17:47:55 +0200 (Thu, 06 May 2010)
> > New Revision: 36659
> > Changeset: http://dev.haiku-os.org/changeset/36659/haiku
> > 
> > Modified:
> >    haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp
> > Log:
> > * Made the se-info attribute endian-aware.
> > * Check in LoadAttrs() if the new frame looks valid, and fits on screen, 
> > and
> >   ignore it if not.
> > * Moved static helper function out of the class definition.
> 
> [...]
> 
> > +// This is a temporary solution for building BString with printf like
> > format.
> > +// will be removed in the future.
> > +static void
> > +bs_printf(BString* string, const char* format, ...)
> > +{
> > +    va_list ap;
> > +    va_start(ap, format);
> > +    char* buf;
> > +    vasprintf(&buf, format, ap);
> > +    string->SetTo(buf);
> > +    free(buf);
> > +    va_end(ap);
> > +}
> 
> I remember wondering about this before... how does it work? Where is the
> storage for buf?

Allocated by the function [1].

CU, Ingo

[1] 
http://dev.haiku-os.org/browser/haiku/trunk/src/system/libroot/posix/glibc/libio/vasprintf.c#L49

Other related posts: