diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-16 03:55:41 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-28 23:06:17 -0400 |
commit | fc1a3e285393446ef3cc2fad07b2611bf2da80d4 (patch) | |
tree | 1b29bee3eb415cac3014dd76a42b05ad93d639d0 | |
parent | f546d9a039d8b1ead4f6b5843e97faf8b4944a70 (diff) |
Migrate to using musl 0.9.13 strnlen for better asm.js performance.
-rw-r--r-- | src/library.js | 9 | ||||
-rw-r--r-- | system/lib/libc/musl/src/string/strnlen.c | 7 | ||||
-rw-r--r-- | system/lib/libcextra.symbols | 1 | ||||
-rw-r--r-- | tools/system_libs.py | 1 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/library.js b/src/library.js index 0726f1a8..543f6f04 100644 --- a/src/library.js +++ b/src/library.js @@ -3639,15 +3639,6 @@ LibraryManager.library = { return pdest|0; }, - strnlen: function(ptr, num) { - num = num >>> 0; - for (var i = 0; i < num; i++) { - if ({{{ makeGetValue('ptr', 0, 'i8') }}} == 0) return i; - ptr++; - } - return num; - }, - strstr: function(ptr1, ptr2) { var check = 0, start; do { diff --git a/system/lib/libc/musl/src/string/strnlen.c b/system/lib/libc/musl/src/string/strnlen.c new file mode 100644 index 00000000..6442eb79 --- /dev/null +++ b/system/lib/libc/musl/src/string/strnlen.c @@ -0,0 +1,7 @@ +#include <string.h> + +size_t strnlen(const char *s, size_t n) +{ + const char *p = memchr(s, 0, n); + return p ? p-s : n; +} diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols index 94cd79be..14b6906e 100644 --- a/system/lib/libcextra.symbols +++ b/system/lib/libcextra.symbols @@ -120,6 +120,7 @@ T strlcpy T strncasecmp_l T strncat + T strnlen T strsep T strspn T strverscmp diff --git a/tools/system_libs.py b/tools/system_libs.py index dc24c1e3..2564460a 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -248,6 +248,7 @@ def calculate(temp_files, in_temp, stdout, stderr): 'strlcat.c', 'strlcpy.c', 'strncat.c', + 'strnlen.c', 'strsep.c', 'strspn.c', 'strverscmp.c', |