From 8a46b88da9e4116460ae66d8760b2bc751e3faef Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Thu, 3 Jan 2019 19:03:16 +0100 Subject: [PATCH] Use g_strcmp0 for string comparisons g_strcmp0 handles NULL values correctly. This allows to omit NULL pointer checks, which would be otherwise crucial. --- src/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.h b/src/utils.h index 8a6f652..65f4cd8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -10,7 +10,7 @@ //! Test if a string is non-NULL and not empty #define STR_FULL(s) !(STR_EMPTY(s)) //! Test if string a and b contain the same chars -#define STR_EQ(a, b) (strcmp(a, b) == 0) +#define STR_EQ(a, b) (g_strcmp0(a, b) == 0) //! Test if string a and b are same up to n chars #define STRN_EQ(a, b, n) (strncmp(a, b, n) == 0) //! Test if string a and b are the same case-insensitively