Thread (56 messages) flat view 56 messages, 7 authors, 2016-06-15
STALE3726d

[PATCH 12/15] strbuf_vaddf(): support %*s, too

From: Miklos Vajna <hidden>
Date: 2016-06-15 22:44:50
Subsystem: the rest · Maintainer: Linus Torvalds

From: Johannes Schindelin <redacted>

The recent addition of graph.c broke things with our custom implementation
of strbuf_vaddf(), because "%*s" was not yet supported (because it did not
have any users before).

Signed-off-by: Johannes Schindelin <redacted>
---
 strbuf.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/strbuf.c b/strbuf.c
index 72b3585..bd5dc80 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -154,6 +154,12 @@ void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap)
 			fill = *p++;
 		if (isdigit(*p))
 			size = (int)strtol(p, &p, 10);
+		else if (*p == '*') {
+			size = va_arg(ap, int);
+			if (!fill)
+				fill = ' ';
+			p++;
+		}
 		else if (!prefixcmp(p, ".*")) {
 			max_size = va_arg(ap, int);
 			p += 2;
-- 
1.5.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help