Re: [libvirt] [PATCH] start using c-ctype functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Veillard <veillard@xxxxxxxxxx> 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 ;-)

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]