Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Adam Simpkins <adam@adamsimpkins.net>, git@vger.kernel.org
Subject: Re: [PATCH] graph.c: fix padding
Date: Thu, 15 May 2008 09:50:05 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0805150947060.30431@racer> (raw)
In-Reply-To: <alpine.DEB.1.00.0805141522060.30431@racer>

Hi,

On Wed, 14 May 2008, Johannes Schindelin wrote:

> There were two instances of "%*s" which want to be "%.*s" instead.
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  graph.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

I am a moron.

Remember when I implemented a custom strbuf_vaddf() implementation that 
did not suffer these workarounds we have for "broken vaddf()" on AIX and 
Windows?

Well, I completely forgot about it, but I still have it in my personal 
tree.

And this implementation did not support "%*s", since there was no user for 
it before the addition of the --graph stuff.

So I have this in my tree now instead of the "fix" I am replying to:

-- snipsnap --
[PATCH] strbuf_vaddf(): support %*s, too

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 466f999..8c11f15 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -155,6 +155,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.5.1.375.g1becb

      reply	other threads:[~2008-05-15  8:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 14:22 [PATCH] graph.c: fix padding Johannes Schindelin
2008-05-15  8:50 ` Johannes Schindelin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0805150947060.30431@racer \
    --to=johannes.schindelin@gmx.de \
    --cc=adam@adamsimpkins.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox