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



On Mon, 24 Dec 2001, ha shao wrote:

> 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.

oh, i see, i didn't recognize the "_chunk" part in your proposal,
because you said glib->gstring and because string chunks don't really
count as active API in my book (i never came around a good practical
usage case, so i'd be interested to hear what you actually use them
for). unfortunately we're API frozen already, so we'll not add new
functions in the near future, you might want to file a feature request
(bug report) against the 2.2 milestone for glib on bugzilla.gnome.org
though, in order to get this functionality into the next development
tree.

> 
> -- 
> Best regard
> hashao

---
ciaoTJ




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