reorder strftime to eliminate the incorrect indention level

this change is in preparation for possibly adding support for the
field width and padding specifiers added in POSIX 2008.
This commit is contained in:
Rich Felker 2013-07-27 17:47:03 -04:00
parent 54446d730c
commit d53b1f820c
1 changed files with 5 additions and 5 deletions

View File

@ -51,7 +51,11 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
const char *fmt; const char *fmt;
size_t l; size_t l;
for (l=0; *f && l<n; f++) { for (l=0; *f && l<n; f++) {
if (*f == '%') { if (*f != '%') {
literal:
s[l++] = *f;
continue;
}
do_fmt: do_fmt:
switch (*++f) { switch (*++f) {
case '%': case '%':
@ -192,10 +196,6 @@ do_fmt:
default: default:
return 0; return 0;
} }
}
literal:
s[l++] = *f;
continue;
number: number:
l += snprintf(s+l, n-l, fmt, val); l += snprintf(s+l, n-l, fmt, val);
continue; continue;