Browse Source

add extra null checsk and remove assert from utilCStrMatch()

remotes/bxxa/master
cinnaboot 4 years ago
parent
commit
a8799ed2f7
  1. 7
      include/util.h

7
include/util.h

@ -182,12 +182,13 @@ utilSafeFree(void* p)
bool bool
utilCStrMatch(const char* str1, const char* str2) utilCStrMatch(const char* str1, const char* str2)
{ {
assert(str1 != nullptr && str2 != nullptr); if (!str1 || !str2)
return false;
u32 l1 = strlen(str1); u32 l1 = strlen(str1);
u32 l2 = strlen(str2); u32 l2 = strlen(str2);
return (l1 == l2) return (l1 == l2 && strncmp(str1, str2, l1) == 0);
&& (strncmp(str1, str2, l1) == 0);
} }
#endif #endif

Loading…
Cancel
Save