Am 2017-01-17 um 12:09 schrieb rastersoft: > That's true for the first one, but the second is as fast as str[0] == 0, > because as soon as one byte doesn't fit, the function ends.
You are right, because str=="" indeed calls g_strcmp0(), but str[0]=='\0' calls string_get() which seems not faster that g_strcmp0(). So the fastest (C-like) solution would be: bool is_null_or_empty3 (string? str) { return str == null || *(char*)str == '\0'; } But it's ugly ;-) _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list