diff --git a/Pal/lib/api.h b/Pal/lib/api.h index 49b960b5..3df25d8e 100644 --- a/Pal/lib/api.h +++ b/Pal/lib/api.h @@ -123,6 +123,7 @@ typedef ptrdiff_t ssize_t; /* Libc String functions string.h/stdlib.h */ size_t strnlen (const char *str, size_t maxlen); size_t strlen (const char *str); +int strcmp(const char* a, const char* b); long strtol (const char *s, char **endptr, int base); int atoi (const char *nptr); diff --git a/Pal/lib/string/strcmp.c b/Pal/lib/string/strcmp.c new file mode 100644 index 00000000..71bb2251 --- /dev/null +++ b/Pal/lib/string/strcmp.c @@ -0,0 +1,22 @@ +#include "api.h" + +/* Copyright © 2005-2014 Rich Felker, et al. */ + +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ + +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ + +/* musl 1.1.24 */ + +int strcmp(const char* l, const char* r) { + for (; *l == *r && *l; l++, r++) + ; + return *(unsigned char*)l - *(unsigned char*)r; +} diff --git a/Pal/regression/normalize_path.c b/Pal/regression/normalize_path.c index 2d8150d0..de8f9767 100644 --- a/Pal/regression/normalize_path.c +++ b/Pal/regression/normalize_path.c @@ -3,12 +3,6 @@ #include "pal_defs.h" #include "pal_error.h" -static int strcmp(const char* a, const char* b) { - for (; *a && *b && *a == *b; a++, b++) - ; - return *a - *b; -} - static const char* get_norm_path_cases[][2] = { {"/", "/"}, {"/a/b/c", "/a/b/c"},