mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Handle nulls properly in the g_strcmp0() for glib<2.16
I wrote some tests to compare the behavior but I don't know where to put them, so i'm including them here: assert(g_strcmp0("a", "b") == -1); assert(g_strcmp0(NULL, "a") == -1); assert(g_strcmp0("a", NULL) == 1); assert(g_strcmp0("b", "a") == 1); assert(g_strcmp0("a", "a") == 0); assert(g_strcmp0(NULL, NULL) == 0);
This commit is contained in:
parent
ef0877f484
commit
9890daca79
@ -53,7 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GLIB_CHECK_VERSION(2,16,0)
|
#if !GLIB_CHECK_VERSION(2,16,0)
|
||||||
#define g_strcmp0(str1, str2) strcmp(str1, str2)
|
#define g_strcmp0(a, b) (!a ? -(a != b) : (!b ? (a != b) : strcmp(a, b)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_GC
|
#ifdef USE_GC
|
||||||
|
Loading…
Reference in New Issue
Block a user