1
0
mirror of https://github.com/irssi/irssi.git synced 2024-08-04 03:34:18 -04: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:
dequis 2015-04-11 15:09:49 -03:00
parent ef0877f484
commit 9890daca79

View File

@ -53,7 +53,7 @@
#endif
#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
#ifdef USE_GC