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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Miklos Vajna
Date: Friday, June 27, 2008 - 9:22 am

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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 <johannes.schindelin@gmx.de>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 09/15] Introduce get_merge_bases_many(), Miklos Vajna, (Fri Jun 27, 9:22 am)
[PATCH 10/15] Introduce reduce_heads(), Miklos Vajna, (Fri Jun 27, 9:22 am)
[PATCH 12/15] strbuf_vaddf(): support %*s, too, Miklos Vajna, (Fri Jun 27, 9:22 am)