aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2014-02-06 17:26:38 -0500
committerJukka Jylänki <jujjyl@gmail.com>2014-02-06 17:26:38 -0500
commit95b77f9e4abac6cb41a5269d087f296ebfac4f66 (patch)
tree73fb57b4b40c10365c38feef7addfdee870475bf
parenta2f95d50985660324812286771dbfdcf7da638a4 (diff)
Add strcoll as well so that library.js does not need to depend on musl libc code.
-rwxr-xr-xemcc1
-rw-r--r--src/library.js7
-rw-r--r--system/lib/libc.symbols3
-rw-r--r--system/lib/libc/musl/src/locale/strcoll.c15
4 files changed, 19 insertions, 7 deletions
diff --git a/emcc b/emcc
index a5432397..dd329006 100755
--- a/emcc
+++ b/emcc
@@ -1545,6 +1545,7 @@ try:
'iswspace_l.c',
'iswupper_l.c',
'iswxdigit_l.c',
+ 'strcoll.c',
'strcasecmp_l.c',
'strfmon.c',
'strncasecmp_l.c',
diff --git a/src/library.js b/src/library.js
index 98d996ab..22fffb88 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3754,13 +3754,6 @@ LibraryManager.library = {
return pdest;
},
- // We always assume ASCII locale.
- strcoll: 'strcmp',
- strcoll_l__deps: ['strcoll'],
- strcoll_l: function(px, py) {
- return _strcoll(px, py); // no locale support yet
- },
-
memchr: function(ptr, chr, num) {
chr = unSign(chr);
for (var i = 0; i < num; i++) {
diff --git a/system/lib/libc.symbols b/system/lib/libc.symbols
index 705b2c88..c427cf6f 100644
--- a/system/lib/libc.symbols
+++ b/system/lib/libc.symbols
@@ -74,6 +74,9 @@
T scalbnl
T memcpy
T strtod
+ T strcoll
+ T __strcoll_l
+ W strcoll_l
T strcmp
T strncmp
T strcasecmp
diff --git a/system/lib/libc/musl/src/locale/strcoll.c b/system/lib/libc/musl/src/locale/strcoll.c
new file mode 100644
index 00000000..39ea1123
--- /dev/null
+++ b/system/lib/libc/musl/src/locale/strcoll.c
@@ -0,0 +1,15 @@
+#include <string.h>
+#include <locale.h>
+#include "libc.h"
+
+int __strcoll_l(const char *l, const char *r, locale_t loc)
+{
+ return strcmp(l, r);
+}
+
+int strcoll(const char *l, const char *r)
+{
+ return __strcoll_l(l, r, 0);
+}
+
+weak_alias(__strcoll_l, strcoll_l);