projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use internal malloc for posix_spawn file actions objects
[musl]
/
src
/
time
/
wcsftime.c
diff --git
a/src/time/wcsftime.c
b/src/time/wcsftime.c
index
8d2a2eb
..
8e1437b
100644
(file)
--- a/
src/time/wcsftime.c
+++ b/
src/time/wcsftime.c
@@
-1,9
+1,8
@@
#include <wchar.h>
#include <time.h>
#include <locale.h>
#include <wchar.h>
#include <time.h>
#include <locale.h>
-#include "libc.h"
-
-const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
+#include "locale_impl.h"
+#include "time_impl.h"
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
{
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
{
@@
-13,7
+12,7
@@
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
wchar_t *p;
const char *t_mb;
const wchar_t *t;
wchar_t *p;
const char *t_mb;
const wchar_t *t;
- int plus;
+ int p
ad, p
lus;
unsigned long width;
for (l=0; l<n; f++) {
if (!*f) {
unsigned long width;
for (l=0; l<n; f++) {
if (!*f) {
@@
-25,6
+24,8
@@
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
continue;
}
f++;
continue;
}
f++;
+ pad = 0;
+ if (*f == '-' || *f == '_' || *f == '0') pad = *f++;
if ((plus = (*f == '+'))) f++;
width = wcstoul(f, &p, 10);
if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') {
if ((plus = (*f == '+'))) f++;
width = wcstoul(f, &p, 10);
if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') {
@@
-34,7
+35,7
@@
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
}
f = p;
if (*f == 'E' || *f == 'O') f++;
}
f = p;
if (*f == 'E' || *f == 'O') f++;
- t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
+ t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc
, pad
);
if (!t_mb) break;
k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
if (k == (size_t)-1) return 0;
if (!t_mb) break;
k = mbstowcs(wbuf, t_mb, sizeof wbuf / sizeof *wbuf);
if (k == (size_t)-1) return 0;
@@
-64,7
+65,7
@@
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, co
size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
{
size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
{
- return __wcsftime_l(wcs, n, f, tm,
0
);
+ return __wcsftime_l(wcs, n, f, tm,
CURRENT_LOCALE
);
}
weak_alias(__wcsftime_l, wcsftime_l);
}
weak_alias(__wcsftime_l, wcsftime_l);