reduce calling of strlen(); #301

This commit is contained in:
Yukihiro Matsumoto
2012-06-21 16:22:29 +09:00
parent d105ea496f
commit a70c4e0c79
6 changed files with 25 additions and 23 deletions
+4 -4
View File
@@ -1069,13 +1069,13 @@ fmt_setup(char *buf, size_t size, int c, int flags, int width, int prec)
if (flags & FSPACE) *buf++ = ' ';
if (flags & FWIDTH) {
snprintf(buf, end - buf, "%d", width);
buf += strlen(buf);
snprintf(buf, end - buf, "%d", width);
buf += strlen(buf);
}
if (flags & FPREC) {
snprintf(buf, end - buf, ".%d", prec);
buf += strlen(buf);
snprintf(buf, end - buf, ".%d", prec);
buf += strlen(buf);
}
*buf++ = c;