mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-22 15:37:59 +00:00
valgrind findings
This commit is contained in:
parent
1759d45132
commit
a59a8d3e92
1 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue