mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
string: fix strncmcp
This commit is contained in:
@@ -68,8 +68,9 @@ size_t strlen(const char *a) {
|
||||
int strncmp(const char *a, const char *b, size_t c) {
|
||||
int diff = 0;
|
||||
|
||||
while (c-- && diff == 0)
|
||||
diff += *a++ - *b++;
|
||||
while (c-- && diff == 0 && *a) {
|
||||
diff += *a++ - *b++;
|
||||
}
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user