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