mirror of
https://github.com/limine-bootloader/limine
synced 2024-12-04 14:11:58 +03:00
Fix handling of return value for strcmp and strncmp
This commit is contained in:
parent
fc23258aa7
commit
e2a87ca33e
BIN
qloader2.bin
BIN
qloader2.bin
Binary file not shown.
@ -92,7 +92,7 @@ int strcmp(const char *s1, const char *s2) {
|
|||||||
for (size_t i = 0; ; i++) {
|
for (size_t i = 0; ; i++) {
|
||||||
char c1 = s1[i], c2 = s2[i];
|
char c1 = s1[i], c2 = s2[i];
|
||||||
if (c1 != c2)
|
if (c1 != c2)
|
||||||
return c1 - c2;
|
return c1 < c2 ? -1 : 1;
|
||||||
if (!c1)
|
if (!c1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ int strncmp(const char *s1, const char *s2, size_t n) {
|
|||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
char c1 = s1[i], c2 = s2[i];
|
char c1 = s1[i], c2 = s2[i];
|
||||||
if (c1 != c2)
|
if (c1 != c2)
|
||||||
return c1 - c2;
|
return c1 < c2 ? -1 : 1;
|
||||||
if (!c1)
|
if (!c1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user