qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, Jes.Sorensen@redhat.com, eblake@redhat.com,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
Date: Tue, 18 Jan 2011 08:24:16 -0700	[thread overview]
Message-ID: <1295364256.30628.6.camel@x201> (raw)
In-Reply-To: <m3r5cain49.fsf@blackfin.pond.sub.org>

On Tue, 2011-01-18 at 10:20 +0100, Markus Armbruster wrote:
> Jes.Sorensen@redhat.com writes:
> 
> > From: Jes Sorensen <Jes.Sorensen@redhat.com>
> >
> > Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> > ---
> >  cutils.c |   10 +++++-----
> >  1 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/cutils.c b/cutils.c
> > index 328738c..f2c8bbd 100644
> > --- a/cutils.c
> > +++ b/cutils.c
> > @@ -324,26 +324,26 @@ ssize_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
> >          }
> >      }
> >      switch (toupper(d)) {
> > -    case 'B':
> > +    case STRTOSZ_DEFSUFFIX_B:
> >          mul = 1;
> >          if (mul_required) {
> >              goto fail;
> >          }
> >          break;
> > -    case 'K':
> > +    case STRTOSZ_DEFSUFFIX_KB:
> >          mul = 1 << 10;
> >          break;
> >      case 0:
> >          if (mul_required) {
> >              goto fail;
> >          }
> > -    case 'M':
> > +    case STRTOSZ_DEFSUFFIX_MB:
> >          mul = 1ULL << 20;
> >          break;
> > -    case 'G':
> > +    case STRTOSZ_DEFSUFFIX_GB:
> >          mul = 1ULL << 30;
> >          break;
> > -    case 'T':
> > +    case STRTOSZ_DEFSUFFIX_TB:
> >          mul = 1ULL << 40;
> >          break;
> >      default:
> 
> And this improves what?  Certainly not clarity.
> 
> In my opinion, the STRTOSZ_DEFSUFFIX_TB are useless chaff.  Chacun à son
> goût.

<shrug> I prefer it.  Better than having 'B'/'K'/'M'/'G'/'T' sprinkled
throughout the code.  Easier to search for, easier to update, more
consistent.

Alex

  parent reply	other threads:[~2011-01-18 15:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 17:12 [Qemu-devel] [PATCH 0/2] strtosz() more cleanups Jes.Sorensen
2011-01-17 17:12 ` [Qemu-devel] [PATCH 1/2] strtosz(): Fix name confusion in use of modf() Jes.Sorensen
2011-01-17 17:12 ` [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement Jes.Sorensen
2011-01-18  9:20   ` Markus Armbruster
2011-01-18  9:22     ` Jes Sorensen
2011-01-18 15:24     ` Alex Williamson [this message]
2011-01-18 16:50     ` Anthony Liguori
2011-01-18 16:52       ` Jes Sorensen
2011-01-18 16:53       ` Eric Blake
2011-01-18 20:30         ` Anthony Liguori
2011-01-18 20:36           ` Jes Sorensen
2011-01-18 20:39             ` Anthony Liguori
2011-01-19 10:03               ` Jes Sorensen
2011-01-17 17:15 ` [Qemu-devel] Re: [PATCH 0/2] strtosz() more cleanups Alex Williamson

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=1295364256.30628.6.camel@x201 \
    --to=alex.williamson@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).