valgrind findings

This commit is contained in:
John Kerl 2015-12-17 09:38:50 -05:00
parent 1759d45132
commit a59a8d3e92

View file

@ -47,7 +47,7 @@ static inline int streqn(char* a, char* b, int n) {
#if 0 // performance comparison
return !strncmp(a, b, n);
#else
while (*a && *b) {
while (n > 0 && *a && *b) {
if (n-- <= 0) {
return TRUE;
}
@ -57,8 +57,10 @@ static inline int streqn(char* a, char* b, int n) {
a++;
b++;
}
if (n == 0)
return TRUE;
if (*a || *b) {
return (n <= 0) ? TRUE : FALSE;
return FALSE;
}
return TRUE;
#endif