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

Daniel Veillard veillard at redhat.com
Fri May 16 08:57:45 UTC 2008


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

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list