All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] strtosz() more cleanups
@ 2011-01-17 17:12 Jes.Sorensen
  2011-01-17 17:12 ` [Qemu-devel] [PATCH 1/2] strtosz(): Fix name confusion in use of modf() Jes.Sorensen
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jes.Sorensen @ 2011-01-17 17:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Alex.Williamson, eblake

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Another two cleanups to strtosz() suggested by Alex Williamson.

I had reversed the use of the names of the return arguments to modf(),
and use the STRTOSZ_DESUFFIX_ macros in the switch() statement.

Cheers,
Jes


Jes Sorensen (2):
  strtosz(): Fix name confusion in use of modf()
  strtosz(): Use suffix macros in switch() statement

 cutils.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

-- 
1.7.3.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 1/2] strtosz(): Fix name confusion in use of modf()
  2011-01-17 17:12 [Qemu-devel] [PATCH 0/2] strtosz() more cleanups Jes.Sorensen
@ 2011-01-17 17:12 ` Jes.Sorensen
  2011-01-17 17:12 ` [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement Jes.Sorensen
  2011-01-17 17:15 ` [Qemu-devel] Re: [PATCH 0/2] strtosz() more cleanups Alex Williamson
  2 siblings, 0 replies; 14+ messages in thread
From: Jes.Sorensen @ 2011-01-17 17:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Alex.Williamson, eblake

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 cutils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cutils.c b/cutils.c
index f7aa90c..328738c 100644
--- a/cutils.c
+++ b/cutils.c
@@ -304,8 +304,8 @@ ssize_t strtosz_suffix(const char *nptr, char **end, const char default_suffix)
     if (isnan(val) || endptr == nptr || errno != 0) {
         goto fail;
     }
-    integral = modf(val, &fraction);
-    if (integral != 0) {
+    fraction = modf(val, &integral);
+    if (fraction != 0) {
         mul_required = 1;
     }
     /*
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  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 ` Jes.Sorensen
  2011-01-18  9:20   ` Markus Armbruster
  2011-01-17 17:15 ` [Qemu-devel] Re: [PATCH 0/2] strtosz() more cleanups Alex Williamson
  2 siblings, 1 reply; 14+ messages in thread
From: Jes.Sorensen @ 2011-01-17 17:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, Alex.Williamson, eblake

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:
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Qemu-devel] Re: [PATCH 0/2] strtosz() more cleanups
  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-17 17:15 ` Alex Williamson
  2 siblings, 0 replies; 14+ messages in thread
From: Alex Williamson @ 2011-01-17 17:15 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: kwolf, eblake, qemu-devel

On Mon, 2011-01-17 at 18:12 +0100, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> Another two cleanups to strtosz() suggested by Alex Williamson.
> 
> I had reversed the use of the names of the return arguments to modf(),
> and use the STRTOSZ_DESUFFIX_ macros in the switch() statement.
> 
> Cheers,
> Jes
> 
> 
> Jes Sorensen (2):
>   strtosz(): Fix name confusion in use of modf()
>   strtosz(): Use suffix macros in switch() statement
> 
>  cutils.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 

Acked-by: Alex Williamson <alex.williamson@redhat.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  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
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Markus Armbruster @ 2011-01-18  9:20 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: kwolf, Alex.Williamson, eblake, qemu-devel

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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18  9:20   ` Markus Armbruster
@ 2011-01-18  9:22     ` Jes Sorensen
  2011-01-18 15:24     ` Alex Williamson
  2011-01-18 16:50     ` Anthony Liguori
  2 siblings, 0 replies; 14+ messages in thread
From: Jes Sorensen @ 2011-01-18  9:22 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, Alex.Williamson, eblake, qemu-devel

On 01/18/11 10:20, Markus Armbruster wrote:
>> 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.

It cuts out lines of code, which is good, and using the macros means the
user is less likely to make a type and use a wrong character.

It's a taste issue though, I agree!

Cheers,
Jes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18  9:20   ` Markus Armbruster
  2011-01-18  9:22     ` Jes Sorensen
@ 2011-01-18 15:24     ` Alex Williamson
  2011-01-18 16:50     ` Anthony Liguori
  2 siblings, 0 replies; 14+ messages in thread
From: Alex Williamson @ 2011-01-18 15:24 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, Jes.Sorensen, eblake, qemu-devel

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18  9:20   ` Markus Armbruster
  2011-01-18  9:22     ` Jes Sorensen
  2011-01-18 15:24     ` Alex Williamson
@ 2011-01-18 16:50     ` Anthony Liguori
  2011-01-18 16:52       ` Jes Sorensen
  2011-01-18 16:53       ` Eric Blake
  2 siblings, 2 replies; 14+ messages in thread
From: Anthony Liguori @ 2011-01-18 16:50 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: kwolf, Jes.Sorensen, Alex.Williamson, eblake, qemu-devel

On 01/18/2011 03:20 AM, 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.
>    

Yeah, I have to agree.  I'm not of the literals are evil camp.

BTW, a useful change would be to accept both upper and lower case letters.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18 16:50     ` Anthony Liguori
@ 2011-01-18 16:52       ` Jes Sorensen
  2011-01-18 16:53       ` Eric Blake
  1 sibling, 0 replies; 14+ messages in thread
From: Jes Sorensen @ 2011-01-18 16:52 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: kwolf, Alex.Williamson, eblake, Markus Armbruster, qemu-devel

On 01/18/11 17:50, Anthony Liguori wrote:
> On 01/18/2011 03:20 AM, 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)) {

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>>>      
>> And this improves what?  Certainly not clarity.
>>
>> In my opinion, the STRTOSZ_DEFSUFFIX_TB are useless chaff.  Chacun à son
>> goût.
>>    
> 
> Yeah, I have to agree.  I'm not of the literals are evil camp.
> 
> BTW, a useful change would be to accept both upper and lower case letters.

It already supports both, it's handle in the toupper() call.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  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
  1 sibling, 1 reply; 14+ messages in thread
From: Eric Blake @ 2011-01-18 16:53 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: kwolf, Jes.Sorensen, Alex.Williamson, Markus Armbruster, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On 01/18/2011 09:50 AM, Anthony Liguori wrote:
>>> @@ -324,26 +324,26 @@ ssize_t strtosz_suffix(const char *nptr, char
>>> **end, const char default_suffix)
>>>           }
>>>       }
>>>       switch (toupper(d)) {
> BTW, a useful change would be to accept both upper and lower case letters.

And it does, via the toupper() added earlier in the series (and which
has separately been pointed out that using qemu_toupper() might be nicer).

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18 16:53       ` Eric Blake
@ 2011-01-18 20:30         ` Anthony Liguori
  2011-01-18 20:36           ` Jes Sorensen
  0 siblings, 1 reply; 14+ messages in thread
From: Anthony Liguori @ 2011-01-18 20:30 UTC (permalink / raw)
  To: Eric Blake
  Cc: kwolf, Jes.Sorensen, Alex.Williamson, Markus Armbruster, qemu-devel

On 01/18/2011 10:53 AM, Eric Blake wrote:
> On 01/18/2011 09:50 AM, Anthony Liguori wrote:
>    
>>>> @@ -324,26 +324,26 @@ ssize_t strtosz_suffix(const char *nptr, char
>>>> **end, const char default_suffix)
>>>>            }
>>>>        }
>>>>        switch (toupper(d)) {
>>>>          
>> BTW, a useful change would be to accept both upper and lower case letters.
>>      
> And it does, via the toupper() added earlier in the series (and which
> has separately been pointed out that using qemu_toupper() might be nicer).
>    

Ok.  Just taking the different case labels would be nicer IMHO.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18 20:30         ` Anthony Liguori
@ 2011-01-18 20:36           ` Jes Sorensen
  2011-01-18 20:39             ` Anthony Liguori
  0 siblings, 1 reply; 14+ messages in thread
From: Jes Sorensen @ 2011-01-18 20:36 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: kwolf, Alex.Williamson, Eric Blake, Markus Armbruster, qemu-devel

On 01/18/11 21:30, Anthony Liguori wrote:
> On 01/18/2011 10:53 AM, Eric Blake wrote:
>> On 01/18/2011 09:50 AM, Anthony Liguori wrote:
>>   
>>>>> @@ -324,26 +324,26 @@ ssize_t strtosz_suffix(const char *nptr, char
>>>>> **end, const char default_suffix)
>>>>>            }
>>>>>        }
>>>>>        switch (toupper(d)) {
>>>>>          
>>> BTW, a useful change would be to accept both upper and lower case
>>> letters.
>>>      
>> And it does, via the toupper() added earlier in the series (and which
>> has separately been pointed out that using qemu_toupper() might be
>> nicer).
>>    
> 
> Ok.  Just taking the different case labels would be nicer IMHO.

The old code did that, but I was suggested to do it this way, which I
think is cleaner too. Fewer lines of code are easier to read.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18 20:36           ` Jes Sorensen
@ 2011-01-18 20:39             ` Anthony Liguori
  2011-01-19 10:03               ` Jes Sorensen
  0 siblings, 1 reply; 14+ messages in thread
From: Anthony Liguori @ 2011-01-18 20:39 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: kwolf, Alex.Williamson, Eric Blake, Markus Armbruster, qemu-devel

On 01/18/2011 02:36 PM, Jes Sorensen wrote:
> On 01/18/11 21:30, Anthony Liguori wrote:
>    
>> On 01/18/2011 10:53 AM, Eric Blake wrote:
>>      
>>> On 01/18/2011 09:50 AM, Anthony Liguori wrote:
>>>
>>>        
>>>>>> @@ -324,26 +324,26 @@ ssize_t strtosz_suffix(const char *nptr, char
>>>>>> **end, const char default_suffix)
>>>>>>             }
>>>>>>         }
>>>>>>         switch (toupper(d)) {
>>>>>>
>>>>>>              
>>>> BTW, a useful change would be to accept both upper and lower case
>>>> letters.
>>>>
>>>>          
>>> And it does, via the toupper() added earlier in the series (and which
>>> has separately been pointed out that using qemu_toupper() might be
>>> nicer).
>>>
>>>        
>> Ok.  Just taking the different case labels would be nicer IMHO.
>>      
> The old code did that, but I was suggested to do it this way, which I
> think is cleaner too. Fewer lines of code are easier to read.
>    

toupper() is based on locale so it's not consistent.

Regards,

Anthony Liguori

> Cheers,
> Jes
>    

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] strtosz(): Use suffix macros in switch() statement
  2011-01-18 20:39             ` Anthony Liguori
@ 2011-01-19 10:03               ` Jes Sorensen
  0 siblings, 0 replies; 14+ messages in thread
From: Jes Sorensen @ 2011-01-19 10:03 UTC (permalink / raw)
  To: Anthony Liguori
  Cc: kwolf, Alex.Williamson, Eric Blake, Markus Armbruster, qemu-devel

On 01/18/11 21:39, Anthony Liguori wrote:
> On 01/18/2011 02:36 PM, Jes Sorensen wrote:
>> On 01/18/11 21:30, Anthony Liguori wrote:  
>>> On 01/18/2011 10:53 AM, Eric Blake wrote:       
>>>> And it does, via the toupper() added earlier in the series (and which
>>>> has separately been pointed out that using qemu_toupper() might be
>>>> nicer).
>>>>        
>>> Ok.  Just taking the different case labels would be nicer IMHO.
>>>      
>> The old code did that, but I was suggested to do it this way, which I
>> think is cleaner too. Fewer lines of code are easier to read.
>>    
> toupper() is based on locale so it's not consistent.

If you can show me an actually used locale where the toupper() on
k/m/g/t doesn't result in K/M/G/T then I guess there's a case. Otherwise
I don't really see this being a real point.

I think we are hitting the point where it's about who's taste is better,
and not about the actual code in this discussion.

One point in favor of the patch is this:

Without the patch:
jes@red-feather qemu]$ size cutils.o
   text	   data	    bss	    dec	    hex	filename
   4212	      0	      0	   4212	   1074	cutils.o
With patch:
[jes@red-feather qemu]$ size cutils.o
   text	   data	    bss	    dec	    hex	filename
   4196	      0	      0	   4196	   1064	cutils.o

IMHO it makes the code easier to read, but beyond that there isn't much.
If people are strongly against it, I'll just drop the patch. It's not
worth our time arguing over this level of detail. Otherwise I'd like to
see it applied.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-01-19 10:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.