Re: [Patch] Add a new function g_string_chunk_n_insert() ?



On Sun, 23 Dec 2001, ha shao wrote:

> 
> This is for glib->gstring.
> 
> The attached patch added a function g_string_chunk_n_insert().
> 
> The function is the same as g_string_chunk_insert() except the new function
> also takes the max number of bytes to insert. The inserted string is
> always null-terminated. The source need not to be null-terminated.
> 
> It is useful for construction of a bunch of strings from 
> a big buffer, e.g. mmapped files. Otherwise, string segments
> have to be explicitly created before insertions. Result in a
> lot of malloc's.

thanks for the patch, but CVS HEAD already contains similar variants:
GString*     g_string_insert_len        (GString         *string,
                                         gssize           pos,
                                         const gchar     *val,
                                         gssize           len);
GString*     g_string_append_len        (GString         *string,
                                         const gchar     *val,
                                         gssize           len);

so gtk+ 2.0 will have this functionality.

> 
> -- 
> Best regard
> hashao
> 

---
ciaoTJ





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