[libvirt] [PATCH] start using c-ctype functions
Jim Meyering
jim at meyering.net
Fri May 16 09:38:31 UTC 2008
Daniel Veillard <veillard at redhat.com> wrote:
> On Thu, May 15, 2008 at 05:56:57PM +0200, Jim Meyering wrote:
>> >From db0ed598dfc045f3937a3629a432d2d703449f50 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering at redhat.com>
>> Date: Wed, 14 May 2008 23:06:15 +0200
>> Subject: [PATCH] start using c-ctype functions
>>
>> Up to now, we've been avoiding ctype functions like isspace, isdigit, etc.
>> Now that we have the c-ctype functions, we can start using them to make
>> the code more readable with changes like these:
>
> okay in principle, as stated previously
>
>
>> - SKIP_SPACES;
>> + SKIP_BLANKS;
> [...]
>> - SKIP_BLANKS;
>> + SKIP_BLANKS_AND_EOL;
>
> i was surprized by the macro renaming initially
>
>> +/* 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.
>
> Patch looks fine to me :-)
Thanks for the review.
I've just committed that and the double-free fix.
More information about the libvir-list
mailing list