Re: [gtk-list] glib strfuncs and portability.



On Mon, 6 Sep 1999, Matthew D Allen wrote:

> 
> Sorry if this is a bit offtopic, but I'm hoping some glib developers might
> be hanging out in here.

yep ;)

> I've noticed that glib has a lot of wrappers/substitute functions for
> things like strerror() and strcasecmp() which I use, and are very helpful
> from a portability standpoint, since if glib compiled for them, I'm over
> the portability hurdle on those functions.
> 
> The question is, is there any possibility that more such
> sometimes-unportable string functions will be added?  In particular, I'd
> like to see strsep() since I have calls in some applications where a
> transformation to strtok() can cause some weird problems  (segfaults,
> hangs, and all other nasty kinds of things depending on platform)

yeah, usually unportable (or on some platforms unimplemented) but still
widely used string functions are a definite target for glib.

> The strsep() manpage mentions how it is somewhat of a replacement for
> strtok() and does some extra positive things, with the downside that it's
> less portable.
> 
> Just a hopeful entry into the glib-wishlist.  :)

not really a whishlist item, look at glib.h:

/* NULL terminated string arrays.
 * g_strsplit() splits up string into max_tokens tokens at delim and
 * returns a newly allocated string array.
 * g_strjoinv() concatenates all of str_array's strings, sliding in an
 * optional separator, the returned string is newly allocated.
 * g_strfreev() frees the array itself and all of its strings.
 */
gchar**  g_strsplit             (const gchar  *string,
                                 const gchar  *delimiter,
                                 gint          max_tokens);
gchar*   g_strjoinv             (const gchar  *separator,
                                 gchar       **str_array);
void     g_strfreev             (gchar       **str_array);


> 
> David Allen
> 

---
ciaoTJ



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