Re: g_malloc overhead



On Thu, Jan 29, 2009 at 5:02 PM, Xavier Bestel <xavier bestel free fr> wrote:
On Thu, 2009-01-29 at 16:51 +0200, Tor Lillqvist wrote:
I think strncpy() is one of the few that needs an utf8 equivalent,
because a char may span several bytes.

Well, he didn't say exactly what semantics he wanted his
g_utf8_strncpy() and g_utf16_strncpy() to have. In the UTF-8 case,
should the "size" mean characters or bytes? In the UTF-16 case,
characters or 16-bit units?

The existing g_utf8_strncpy() has it meaning characters. As such I
think the name is bit unfortunate, because of the similarity to
strncpy() but then different semantics of the "size" parameter.

Even if the meaning was "bytes", I think an utf8-aware function that
avoids cutting in the middle of a multibyte char is a plus.

Then the meaning wouldn't be bytes anymore. It would be bytes with
some exceptions, which would A LOT more confusing.


       Xav


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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