[libvirt] [PATCH] start using c-ctype functions
Jim Meyering
jim at meyering.net
Fri May 16 09:39:56 UTC 2008
Daniel Veillard <veillard at redhat.com> wrote:
>> +/* Convert C from hexadecimal character to integer. */
>> +static int
>> +hextobin (unsigned char c)
>> +{
>> + switch (c)
>> + {
>> + default: return c - '0';
>> + case 'a': case 'A': return 10;
>> + case 'b': case 'B': return 11;
>> + case 'c': case 'C': return 12;
>> + case 'd': case 'D': return 13;
>> + case 'e': case 'E': return 14;
>> + case 'f': case 'F': return 15;
>> + }
>> +}
>
> putting the default first feels strange to me, i guess it's the
> first time I see a switch that way.
BTW, I too found that odd.
It's copied verbatim from coreutils/src/echo.c ;-)
More information about the libvir-list
mailing list