mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 23:18:21 +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 strncmp(const char *a, const char *b, size_t c) {
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
|
|
||||||
while (c-- && diff == 0)
|
while (c-- && diff == 0 && *a) {
|
||||||
diff += *a++ - *b++;
|
diff += *a++ - *b++;
|
||||||
|
}
|
||||||
|
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user