summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-06-23 11:07:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-07-06 15:15:20 +1000
commitfe8861338242762da6a3245a106042266280714c (patch)
treebddc6826faa0d6c26ecd73bc560a6553b1c1b925 /src
parent9b1b0c574322c0e27ab281a1aeff5499df637048 (diff)
downloadxorg-lib-libxkbcommon-fe8861338242762da6a3245a106042266280714c.tar.gz
utils: add streq_null() for streq that allows NULL values
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/utils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index abeaabd..67080d0 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -70,6 +70,14 @@ streq(const char *s1, const char *s2)
}
static inline bool
+streq_null(const char *s1, const char *s2)
+{
+ if (s1 == NULL || s2 == NULL)
+ return s1 == s2;
+ return streq(s1, s2);
+}
+
+static inline bool
streq_not_null(const char *s1, const char *s2)
{
if (!s1 || !s2)