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

On Mon, Dec 24, 2001 at 12:34:38AM +0100, timj gtk org wrote:
> 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.

A bit confusing here, I think. The function I suggested is
for the chunk variant, g_string_chunk_n_insert. 

The confusing might be raised because I said the function is for
glib->gstring, what I really meant is the g_string_chunk
is also in the gstring.[ch] files.

P.S. The inserted string will not contain null in the middle.
     This is a bit difference from g_string_insert_len.

Best regard

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