All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] printf: support field padding
Date: Thu, 2 Jan 2014 18:09:48 +0100	[thread overview]
Message-ID: <20140102170948.GH9725@hawk.usersys.redhat.com> (raw)
In-Reply-To: <20131229063144.GI13601@cbox>

On Sat, Dec 28, 2013 at 10:31:44PM -0800, Christoffer Dall wrote:
> > +
> > +    if (npad < 0) {
> > +	char pad = props.pad;
> > +	if (pad == '0') /* ignore '0' flag with '-' flag */
> > +	    pad = ' ';
> 
> there are only the two options, so you can drop the check if
> you like.

true. removed.

> > +static int fmtnum(const char **fmt)
> > +{
> > +    const char *f = *fmt;
> > +    int len = 0, num;
> > +
> > +    if (*f == '-')
> > +	++f, ++len;
> 
> oh wow, this deserves a small comment saying that negative values are
> used to add trailing padding instead of leading.

You mean something beyond "man 3 printf; /flag"? :-)

> 
> > +
> > +    while (*f >= '0' && *f <= '9')
> > +	++f, ++len;
> > +
> > +    num = atol(*fmt);
> > +    *fmt += len;
> > +    return num;
> >  }
> 
> some funny indentation is back here...  Better check your entire patch
> for that.

The whole file has the funny indentation, I just followed suit. The
alternative is to add a patch that "fixes" all the pre-existing lib/*
files first, but for this patch I didn't think it was worth it.

drew

  reply	other threads:[~2014-01-02 17:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 10:58 [PATCH v2 0/3] kvm-unit-tests/arm: add vectors support Andrew Jones
2013-12-13 10:58 ` [PATCH 1/3] printf: support field padding Andrew Jones
2013-12-29  6:31   ` Christoffer Dall
2014-01-02 17:09     ` Andrew Jones [this message]
2014-01-02 17:25       ` Christoffer Dall
2013-12-13 10:58 ` [PATCH 2/3] arm: add useful headers from the linux kernel Andrew Jones
2013-12-29  6:31   ` Christoffer Dall
2014-01-02 17:24     ` Andrew Jones
2014-01-02 18:08       ` Christoffer Dall
2013-12-13 10:58 ` [PATCH 3/3] arm: vectors support Andrew Jones
2013-12-29  6:32   ` Christoffer Dall
2013-12-29 10:21     ` Peter Maydell
2014-01-02 18:36     ` Andrew Jones
2014-01-02 21:04       ` Christoffer Dall

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=20140102170948.GH9725@hawk.usersys.redhat.com \
    --to=drjones@redhat.com \
    --cc=christoffer.dall@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.