Re: g_string_new_len(const gchar *, GSSIZE) (glib-2.0)

Mark Mielke <mark mark mielke cc> writes:
> If the GString structure uses gsize, why does g_string_new_len() use
> gssize?

Because conventionally whenever you pass in a "len" in glib/gtk, you
can pass "-1" to mean "nul-terminated, do a strlen() for me"
> Specifically, I am dealing with code that might use a GString to hold
> a very large piece of data, with little range structures to refer to
> pieces of the string. If necessary, I may need to copy the piece of
> the string into its own string in order to perform local
> modifications. g_string_new_len() appears to be the perfect candidate
> for this... except that it uses gssize as an argument.

GString isn't really optimized for strings over 2 gigabytes. ;-)
You could use GArray perhaps. It uses guint instead of gsize though,
which is more or less a bug.

I'm not even sure all platforms will allocate a block of that size,


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