Skip to content

Commit

Permalink
Introduce String_eq_nullable()
Browse files Browse the repository at this point in the history
  • Loading branch information
cgzones committed Sep 3, 2023
1 parent c686edc commit 02dd7eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions XUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,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;
}

char* String_cat(const char* s1, const char* s2) ATTR_MALLOC;

char* String_trim(const char* in) ATTR_MALLOC;
Expand Down

0 comments on commit 02dd7eb

Please sign in to comment.