[utils] string_equals with NULL check

This commit is contained in:
Al
2015-12-01 13:09:29 -05:00
parent f322ae0a1c
commit d0aaff1482
2 changed files with 7 additions and 0 deletions

View File

@@ -71,6 +71,11 @@ inline bool string_ends_with(const char *str, const char *ending) {
return str_len < end_len ? false : !strcmp(str + str_len - end_len, ending);
}
inline bool string_equals(const char *s1, const char *s2) {
if (s1 == NULL || s2 == NULL) return false;
return strcmp(s1, s2) == 0;
}
inline void string_upper(char *s) {
for (; *s; ++s) *s = toupper(*s);
}