Bug in talloc_asprintf_append()

tridge at samba.org tridge at samba.org
Fri Sep 14 22:38:54 GMT 2007


Simo,

 > What about instead a function that tales a len field called something
 > like: talloc_*_append_at(), where you define at what point exactly you
 > want to append to, this would move the decision to check for length or
 > not in the caller, which can reuse an already calculated length if
 > necessary.

the point of the function was to take advantage of the internal length
tracked by talloc. If the caller has to track it then we lose that
advantage, and it will be much more error prone. You'd also have to
call strlen() in the caller to re-calculate the length of the string
each time, which is what we're trying to avoid.

talloc_asprintf_append_buffer() is a better solution.

Cheers, Tridge


More information about the samba-technical mailing list