On Mon, 2005-03-07 at 05:46 +0100, Volker Lendecke wrote:
> On Sun, Mar 06, 2005 at 07:57:58PM +0100, Simo Sorce wrote:
> > > BTW, sprintf_append is a little utility function to step-by-step sprintf a
> > > string without too much copying. Might be interesting elsewere as well.

> >
> > why not use just asprintf and use %s as the first 2 char of format
> > string and the string to be appended to as the first parameter?

>
> Efficiency. If you create large strings, you don't want to memcpy everything
> every time.


Well reading the code I see that you it may copy everything on realloc
and everything is copied twice on the "attached" part, once on vasprintf
call and the second on StrnCpy.

If the "attached" parts are tiny it may be worth.

Simo.

--
Simo Sorce - idra@samba.org
Samba Team - http://www.samba.org
Italian Site - http://samba.xsec.it