mirror of
https://github.com/fluencelabs/musl
synced 2025-05-14 00:01:35 +00:00
sadly the C language does not specify any such implicit conversion, so this is not a matter of just fixing warnings (as gcc treats it) but actual errors. i would like to revisit a number of these changes and possibly revise the types used to reduce the number of casts required.
10 lines
220 B
C
10 lines
220 B
C
#include <string.h>
|
|
|
|
int strncmp(const char *_l, const char *_r, size_t n)
|
|
{
|
|
const unsigned char *l=(void *)_l, *r=(void *)_r;
|
|
if (!n--) return 0;
|
|
for (; *l && *r && n && *l == *r ; l++, r++, n--);
|
|
return *l - *r;
|
|
}
|