[Bf-committers] Re: [Bf-blender-cvs]
CVS commit: blender/source/blender/src header_info.c usiblender.c
emil at obsession.se
Tue May 30 13:49:30 CEST 2006
Jiří Hnídek wrote:
> Hi Ton,
> why need I store length of string? I can use function strlen(string),
> can't I. What should do generic string manipulation library? I guess, I
> could write one.
I wondered that too ... My thought was that it's often useful when
storing a string from the user, to know how much buffer space is
available where you store it. With typical solutions (static array, or
memory from malloc()), you need to keep track of that size, and pass it
to the function that stores the string (like strncpy() or, imo far
better if portability allows it, snprintf()). If you can instead "ask"
the buffer itself, you don't need to keep track of that.
Of course, my familiarity with string handling in Blender is highly
limited, I just wanted to share an interpretation. :)
A string library sounds ... interesting.
> Ton Roosendaal wrote:
>>> I'm just rewriting recent open as ListBase and I would like to
>>> replace sce, lib, ima with pointers at char in the
>>> future too.
>> A nice generic string manipulation lib would help too :)
>> Using our secured malloc, any malloc can always be verified to return
>> the data allocation size, with this call;
>> So you don't need to store string lengths.
> Bf-committers mailing list
> Bf-committers at projects.blender.org
More information about the Bf-committers