diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-16 03:51:58 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-03-28 23:06:17 -0400 |
commit | d468544eec5b4900228a19b5af1fa0d051e736ac (patch) | |
tree | 5233a5071ebbc40a6278737a36bd0a13c85ab86d | |
parent | 3d4e9a45fc13d559aaaaed8f37ed10e26482b597 (diff) |
Migrate to using musl 0.9.13 strncat for better asm.js performance.
-rw-r--r-- | src/library.js | 16 | ||||
-rw-r--r-- | system/lib/libc/musl/src/string/strncat.c | 10 | ||||
-rw-r--r-- | system/lib/libcextra.symbols | 1 | ||||
-rw-r--r-- | tools/system_libs.py | 1 |
4 files changed, 12 insertions, 16 deletions
diff --git a/src/library.js b/src/library.js index 225ca1b3..9114a539 100644 --- a/src/library.js +++ b/src/library.js @@ -3639,22 +3639,6 @@ LibraryManager.library = { return pdest|0; }, - strncat__deps: ['strlen'], - strncat: function(pdest, psrc, num) { - var len = _strlen(pdest); - var i = 0; - while(1) { - {{{ makeCopyValues('pdest+len+i', 'psrc+i', 1, 'i8', null, 1) }}}; - if ({{{ makeGetValue('pdest', 'len+i', 'i8') }}} == 0) break; - i ++; - if (i == num) { - {{{ makeSetValue('pdest', 'len+i', 0, 'i8') }}}; - break; - } - } - return pdest; - }, - memchr: function(ptr, chr, num) { chr = unSign(chr); for (var i = 0; i < num; i++) { diff --git a/system/lib/libc/musl/src/string/strncat.c b/system/lib/libc/musl/src/string/strncat.c new file mode 100644 index 00000000..01ca2a23 --- /dev/null +++ b/system/lib/libc/musl/src/string/strncat.c @@ -0,0 +1,10 @@ +#include <string.h> + +char *strncat(char *restrict d, const char *restrict s, size_t n) +{ + char *a = d; + d += strlen(d); + while (n && *s) n--, *d++ = *s++; + *d++ = 0; + return a; +} diff --git a/system/lib/libcextra.symbols b/system/lib/libcextra.symbols index fc3eaf99..30a39d52 100644 --- a/system/lib/libcextra.symbols +++ b/system/lib/libcextra.symbols @@ -118,6 +118,7 @@ T strlcat T strlcpy T strncasecmp_l + T strncat T strsep T strspn T strverscmp diff --git a/tools/system_libs.py b/tools/system_libs.py index c02583c8..6814e806 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -246,6 +246,7 @@ def calculate(temp_files, in_temp, stdout, stderr): 'strcspn.c', 'strlcat.c', 'strlcpy.c', + 'strncat.c', 'strsep.c', 'strspn.c', 'strverscmp.c', |