[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() st
From: |
Alex Williamson |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement |
Date: |
Tue, 18 Jan 2011 08:24:16 -0700 |
On Tue, 2011-01-18 at 10:20 +0100, Markus Armbruster wrote:
> address@hidden writes:
>
> > From: Jes Sorensen <address@hidden>
> >
> > Signed-off-by: Jes Sorensen <address@hidden>
> > ---
> > 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
- [Qemu-devel] [PATCH 0/2] strtosz() more cleanups, Jes . Sorensen, 2011/01/17
- [Qemu-devel] [PATCH 1/2] strtosz(): Fix name confusion in use of modf(), Jes . Sorensen, 2011/01/17
- [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Jes . Sorensen, 2011/01/17
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Markus Armbruster, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Jes Sorensen, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement,
Alex Williamson <=
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Anthony Liguori, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Jes Sorensen, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Eric Blake, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Anthony Liguori, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Jes Sorensen, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Anthony Liguori, 2011/01/18
- Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement, Jes Sorensen, 2011/01/19
[Qemu-devel] Re: [PATCH 0/2] strtosz() more cleanups, Alex Williamson, 2011/01/17