Skip to content

Commit f53a8e7

Browse files
committed
lib/libc/string0.c: Remove include of std.h, replace with string.h.
Much more portable this way.
1 parent 1c9a499 commit f53a8e7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/libc/string0.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*/
2626

2727
#include <stdint.h>
28-
#include "std.h"
28+
#include <string.h>
2929

3030
#define likely(x) __builtin_expect((x), 1)
3131

@@ -102,10 +102,12 @@ void *memset(void *s, int c, size_t n) {
102102
return s;
103103
}
104104

105-
int memcmp(const char *s1, const char *s2, size_t n) {
105+
int memcmp(const void *s1, const void *s2, size_t n) {
106+
const uint8_t *s1_8 = s1;
107+
const uint8_t *s2_8 = s2;
106108
while (n--) {
107-
char c1 = *s1++;
108-
char c2 = *s2++;
109+
char c1 = *s1_8++;
110+
char c2 = *s2_8++;
109111
if (c1 < c2) return -1;
110112
else if (c1 > c2) return 1;
111113
}

0 commit comments

Comments
 (0)