svn commit: samba r20570 - in branches/SAMBA_4_0/source/libnet: .

tridge at samba.org tridge at samba.org
Tue Jan 9 23:35:52 GMT 2007


Andrew,

 > > This matter in this case because strlower_talloc() over allocates
 > > 
 > > tridge: how should we fix this in lib/talloc/?
 > 
 > I can't imagine anyone who expects this behaviour:  The extra strlen()
 > is a small price to pay for sanity.  You are not meant to know that
 > talloc() has magic internal state...

unfortunately if we change this it makes a loop which appends strings
O(n^2) instead of O(n). We use talloc_asprintf_append() in a loop like
that in a few places, and those could become unbearably slow if we use
strlen each time (eg. when constructing a schema).

I'd rather fix strlower_talloc() to do a talloc_realloc() at the end
so it has the right size.

Cheers, Tridge


More information about the samba-technical mailing list