about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-07-27 17:47:03 -0400
committerRich Felker <dalias@aerifal.cx>2013-07-27 17:47:03 -0400
commitd53b1f820c8882906511f16dbdeda0d69ae38c47 (patch)
tree707ea96bcf66dfbbb0576ea3fc2c9f58d82b86ff
parent54446d730cfb17c5f7bcf57f139458678f5066cc (diff)
downloadmusl-d53b1f820c8882906511f16dbdeda0d69ae38c47.tar.gz
musl-d53b1f820c8882906511f16dbdeda0d69ae38c47.tar.xz
musl-d53b1f820c8882906511f16dbdeda0d69ae38c47.zip
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.
-rw-r--r--src/time/strftime.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/time/strftime.c b/src/time/strftime.c
index 592b214d..96cb996d 100644
--- a/src/time/strftime.c
+++ b/src/time/strftime.c
@@ -51,7 +51,11 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
 	const char *fmt;
 	size_t l;
 	for (l=0; *f && l<n; f++) {
-		if (*f == '%') {
+		if (*f != '%') {
+literal:
+			s[l++] = *f;
+			continue;
+		}
 do_fmt:
 		switch (*++f) {
 		case '%':
@@ -192,10 +196,6 @@ do_fmt:
 		default:
 			return 0;
 		}
-		}
-literal:
-		s[l++] = *f;
-		continue;
 number:
 		l += snprintf(s+l, n-l, fmt, val);
 		continue;