From: Justin Cinkelj <justin.cink...@xlab.si>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

libc: add __mbrlen

At least a symbol needs to be defined for python2.7.
File mbrlen.c is moved from musl/ to libc/, as the weak alias declaration
must be in same file as function definition.

Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si>
Message-Id: <20170721104513.9854-3-justin.cink...@xlab.si>

---
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1331,7 +1331,7 @@ libc += misc/__longjmp_chk.o
 musl += multibyte/btowc.o
 musl += multibyte/internal.o
 musl += multibyte/mblen.o
-musl += multibyte/mbrlen.o
+libc += multibyte/mbrlen.o
 musl += multibyte/mbrtowc.o
 musl += multibyte/mbsinit.o
 musl += multibyte/mbsnrtowcs.o
diff --git a/libc/multibyte/mbrlen.c b/libc/multibyte/mbrlen.c
--- a/libc/multibyte/mbrlen.c
+++ b/libc/multibyte/mbrlen.c
@@ -0,0 +1,20 @@
+/*
+ * This code was written by Rich Felker in 2010; no copyright is claimed.
+ * This code is in the public domain. Attribution is appreciated but
+ * unnecessary.
+ */
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <wchar.h>
+#include <errno.h>
+
+//#include "internal.h"
+
+size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st)
+{
+       static unsigned internal;
+       return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal);
+}
+
+size_t __mbrlen (const char *, size_t, mbstate_t *) __attribute__ ((weak, alias ("mbrlen")));

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to