much annoyance over string limit lengths

Andrew Tridgell tridge at samba.anu.edu.au
Sun Apr 12 01:30:16 GMT 1998


Luke wrote:
> this is not a good solution.  what really needs to happen is that strings
> should be dynamically allocated.

yes, I'd like to eventually get rid of pstring and fstring and start
using dynamic allocation. It isn't quite as easy as you think though.

One of the main reasons for using the static (and rather large)
strings is to support all those % macros. If you dynamically allocate
strings then you either need to overallocate or reallocate when a
substitution is done. Either way you need to start using not a "char
*" but some sort of string structure, with information about how long
the string is, how much is allocated etc. We could do that but it
would require quite a lot of effort.

I did in fact start on this, and I converted loadparm to use it. See
string_init(), string_free() and string_set(). I didn't use a
structure instead I always passed a "char **" which gave sufficient
information. 

I think we will eventually convert the whole of Samba to a new string
handling scheme, but I don't think that the time to do it is right
now. We have enough major changes going on already.

Cheers, Andrew


More information about the samba-technical mailing list