diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-16 04:02:08 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-28 23:06:17 -0400 |
commit | c4363b595cb2529345e3248b1f374595e83953ff (patch) | |
tree | 6bb97280c031f57a87c886bef10cd691fe60cbc7 /system | |
parent | 4fc97c69d66a81e93849ebbff1f6eed8be7dd174 (diff) |
Migrate to using musl 0.9.13 strchr, strrchr, index and rindex for better asm.js performance.
Diffstat (limited to 'system')
-rw-r--r-- | system/lib/libc/musl/src/string/index.c | 7 | ||||
-rw-r--r-- | system/lib/libc/musl/src/string/rindex.c | 7 | ||||
-rw-r--r-- | system/lib/libc/musl/src/string/strchr.c | 9 | ||||
-rw-r--r-- | system/lib/libc/musl/src/string/strrchr.c | 8 | ||||
-rw-r--r-- | system/lib/libcextra.symbols | 4 |
5 files changed, 35 insertions, 0 deletions
diff --git a/system/lib/libc/musl/src/string/index.c b/system/lib/libc/musl/src/string/index.c new file mode 100644 index 00000000..dd611251 --- /dev/null +++ b/system/lib/libc/musl/src/string/index.c @@ -0,0 +1,7 @@ +#include <string.h> +#include <strings.h> + +char *index(const char *s, int c) +{ + return strchr(s, c); +} diff --git a/system/lib/libc/musl/src/string/rindex.c b/system/lib/libc/musl/src/string/rindex.c new file mode 100644 index 00000000..17df2bf2 --- /dev/null +++ b/system/lib/libc/musl/src/string/rindex.c @@ -0,0 +1,7 @@ +#include <string.h> +#include <strings.h> + +char *rindex(const char *s, int c) +{ + return strrchr(s, c); +} diff --git a/system/lib/libc/musl/src/string/strchr.c b/system/lib/libc/musl/src/string/strchr.c new file mode 100644 index 00000000..bfae8f9f --- /dev/null +++ b/system/lib/libc/musl/src/string/strchr.c @@ -0,0 +1,9 @@ +#include <string.h> + +char *__strchrnul(const char *, int); + +char *strchr(const char *s, int c) +{ + char *r = __strchrnul(s, c); + return *(unsigned char *)r == (unsigned char)c ? r : 0; +} diff --git a/system/lib/libc/musl/src/string/strrchr.c b/system/lib/libc/musl/src/string/strrchr.c new file mode 100644 index 00000000..635fb3c1 --- /dev/null +++ b/system/lib/libc/musl/src/string/strrchr.c @@ -0,0 +1,8 @@ +#include <string.h> + +void *__memrchr(const void *, int, size_t); + +char *strrchr(const char *s, int c) +{ + return __memrchr(s, c, strlen(s) + 1); +} diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols index bc69bb65..dedfcedd 100644 --- a/system/lib/libcextra.symbols +++ b/system/lib/libcextra.symbols @@ -45,6 +45,7 @@ T ilogb T ilogbf T ilogbl + T index T iswalnum T iswalnum_l T iswalpha @@ -107,12 +108,14 @@ T regerror T regexec T regfree + T rindex T scalbnf D signgam T stpcpy T strcasecmp_l T strcasestr W strchrnul + T strchr T strcspn T strfmon T strfmon_l @@ -121,6 +124,7 @@ T strncasecmp_l T strncat T strnlen + T strrchr T strsep T strspn T strstr |