Behdad Esfahbod wrote:
>> Sure, but then there's memcpy, memcmp, memdup, etc for the other behavior.

And they take "void *", not "char *", to indicate this fact.

I'm not arguing that a "validate UTF-8 bytes possibly including NULs"
function wouldn't be useful to some people, I'm just arguing that
g_utf8_validate() shouldn't be that function, because g_utf8_validate()
works on strings, and strings end at NUL.

> Lemme repeat again: When dealing with UTF-8 text, a max-length makes zero
> sense without inspecting the string first.  So the strncpy, etc behavior is
> not relevant.

Not always true. You might do something like:

    if (!g_utf8_validate (string, strcspn (string, "/"))) {

(to validate to the end of the string, or the first "/", whichever comes
first).

But at any rate, even if it was true, that would be an argument for
"g_utf8_validate() shouldn't have a length argument at all", not
"g_utf8_validate() should behave differently from other string methods
when you pass it a length".

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

Reply via email to