summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-10-26 15:15:11 +0100
committerTyge Løvset <[email protected]>2020-10-26 15:15:11 +0100
commit0c64199a35a8901a4969f8c2ce0c0483f184732c (patch)
treedc3bb53c7f7fcb99950c75e3fe0fa988cf5c568c
parenta04ffa9e4d3478c7af7dd7cbe25764aa061a23de (diff)
downloadSTC-modified-0c64199a35a8901a4969f8c2ce0c0483f184732c.tar.gz
STC-modified-0c64199a35a8901a4969f8c2ce0c0483f184732c.zip
Final fix.
-rw-r--r--stc/cfmt.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/stc/cfmt.h b/stc/cfmt.h
index 483d97d9..afb53018 100644
--- a/stc/cfmt.h
+++ b/stc/cfmt.h
@@ -195,7 +195,7 @@ _cfmt_conv(int nargs, const char *fmt, ...) {
*p++ = '%';
break;
case '}':
- if (fmt[1] == '}') ++fmt;
+ fmt += fmt[1] == '}';
break;
case '{':
if (fmt[1] == '{') { ++fmt; break; }
@@ -208,8 +208,7 @@ _cfmt_conv(int nargs, const char *fmt, ...) {
arg = va_arg(args, char *);
*p++ = '%'; p0 = p; align = 0;
while (1) switch (*fmt) {
- case '\0': goto done;
- case '}': ++fmt; goto done;
+ case '}': case '\0': goto done;
case '-': ++fmt; break;
case '>': ++fmt, align = 1; break;
case '<': *p++ = '-', ++fmt, align = 1; break;
@@ -223,6 +222,7 @@ _cfmt_conv(int nargs, const char *fmt, ...) {
memmove(p0+1, p0, p-p0), *p0 = '+', *p++ = 'd';
else if (!align && strchr("cs", p[-1]))
memmove(p0+1, p0, p-p0), *p0 = '-', ++p;
+ fmt += *fmt == '}';
continue;
}
*p++ = *fmt++;