소스 검색

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.
Rich Felker 11 년 전
부모
커밋
d53b1f820c
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      src/time/strftime.c

+ 5 - 5
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;