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

Reply via email to