From: Christoffer Dall <christoffer.dall@linaro.org>
To: Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] printf: support field padding
Date: Thu, 2 Jan 2014 09:25:56 -0800 [thread overview]
Message-ID: <20140102172556.GF27806@cbox> (raw)
In-Reply-To: <20140102170948.GH9725@hawk.usersys.redhat.com>
On Thu, Jan 02, 2014 at 06:09:48PM +0100, Andrew Jones wrote:
> 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"? :-)
>
yes, that's a functional description, not helping the reader of the
implememtation. But ok, once this works, it's not likely to pass many
eyes again.
> >
> > > +
> > > + 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.
>
fair enough, but it really hurts when reading patches so we should fix
this some time...
-Christoffer
next prev parent reply other threads:[~2014-01-02 17:25 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
2014-01-02 17:25 ` Christoffer Dall [this message]
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=20140102172556.GF27806@cbox \
--to=christoffer.dall@linaro.org \
--cc=drjones@redhat.com \
--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.