diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2023-09-03 21:22:36 +0200 |
---|---|---|
committer | cgzones <cgzones@googlemail.com> | 2024-03-27 19:49:23 +0100 |
commit | 4e340c1817aaf61068aa746aad00197d969250b3 (patch) | |
tree | 7336068b3bf4fcf0c31d750a1bb1fd31735d0f1b /XUtils.h | |
parent | cbcfc5f7d08e210a3477071607a3195fa31f06a3 (diff) |
Introduce String_eq_nullable()
Diffstat (limited to 'XUtils.h')
-rw-r--r-- | XUtils.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -54,6 +54,16 @@ static inline bool String_eq(const char* s1, const char* s2) { return strcmp(s1, s2) == 0; } +static inline bool String_eq_nullable(const char* s1, const char* s2) { + if (s1 == s2) + return true; + + if (s1 && s2) + return String_eq(s1, s2); + + return false; +} + ATTR_NONNULL char* String_cat(const char* s1, const char* s2) ATTR_MALLOC; |