From: Waldemar Kozaczuk <[email protected]> Committer: Nadav Har'El <[email protected]> Branch: master
libc: replaced wcsftime files with their almost identical musl copies Signed-off-by: Waldemar Kozaczuk <[email protected]> Message-Id: <[email protected]> --- diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1057,7 +1057,6 @@ musl += locale/towlower_l.o musl += locale/towupper_l.o libc += locale/uselocale.o musl += locale/wcscoll.o -libc += locale/wcsftime_l.o musl += locale/wcsxfrm.o musl += locale/wctrans_l.o musl += locale/wctype_l.o @@ -1665,7 +1664,7 @@ musl += time/strftime.o musl += time/strptime.o musl += time/time.o musl += time/timegm.o -libc += time/wcsftime.o +musl += time/wcsftime.o libc += time/ftime.o # verbatim copy of the file as in 4b15d9f46a2b@musl $(out)/libc/time/ftime.o: CFLAGS += -Ilibc/include diff --git a/libc/locale/wcsftime_l.c b/libc/locale/wcsftime_l.c --- a/libc/locale/wcsftime_l.c +++ b/libc/locale/wcsftime_l.c @@ -1,11 +0,0 @@ -#include <wchar.h> -#include <time.h> - -#include "libc.h" - -size_t __wcsftime_l(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, - const struct tm *restrict tm, locale_t loc) -{ - return wcsftime(wcs, n, f, tm); -} -weak_alias(__wcsftime_l, wcsftime_l); diff --git a/libc/time/wcsftime.c b/libc/time/wcsftime.c --- a/libc/time/wcsftime.c +++ b/libc/time/wcsftime.c @@ -1,32 +0,0 @@ -#include <wchar.h> -#include <time.h> -#include <string.h> - -size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm) -{ - size_t k, n0=n; - char out[100], in[4]; - while (*f) { - if (!n) return 0; - if (*f != '%') { - *wcs++ = *f++; - n--; - continue; - } - in[2] = in[3] = 0; - in[0] = *f++; - if (strchr("EO", (in[1]=*f++))) - in[2] = *f++; - k = strftime(out, sizeof out, in, tm); - if (!k) return 0; - k = mbsrtowcs(wcs, (const char *[]){out}, n, 0); - if (k==(size_t)-1) return 0; - wcs += k; - n -= k; - } - if (!n) return 0; - *wcs++ = 0; - return n0-n; -} - - -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000ce38c905adc3a647%40google.com.
