Re: g_malloc overhead



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.

        Xav





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