Re: Some new GString functions - constructors



On Tue, Dec 20, 2005 at 02:43:43PM -0800, Alan M. Evans wrote:
> GStrings are already guaranteed to have a nul terminating byte, aren't
> they?

Ah; yes, in fact, they are. I had thought they weren't, in the case of
calling g_string_new_len(), because I tried it one time and found a bug.
I'd just presumed that it wasn't nul-terminated, so went and added the
_lenz() constructor instead.

On reading the gstring.c file, I note actually yes, this constructor
should nul-terminate the string. I guess my _lenz() constructor is rather
useless now then.

Sorry about that...

I guess that means the g_string_slice() constructor could actually be
written quite easily by wrapping g_string_new_len() instead.

-- 
Paul "LeoNerd" Evans

leonerd leonerd org uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]