qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V3 9/9] qapi script: do not add "_" for every ca


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH V3 9/9] qapi script: do not add "_" for every capitalized char in enum
Date: Wed, 04 Dec 2013 15:58:38 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/29/2013 01:41 AM, Wenchao Xia wrote:
> Now "enum AIOContext" will generate AIO_CONTEXT instead of A_I_O_CONTEXT,
> "X86CPU" will generate X86_CPU instead of X86_C_P_U.
> 
> Signed-off-by: Wenchao Xia <address@hidden>
> ---

> +    l = len(c_fun_str)
> +    for i in range(l):
> +        c = c_fun_str[i]
> +        # When c is upper and no "_" appear before, do more check

s/appear/appears/   s/check/checks/

> +        if c.isupper() and (i > 0) and c_fun_str[i - 1] != "_":
> +            # Case 1: Next string is lower
> +            # Case 2: previous string is digit
> +            if (i < (l - 1) and c_fun_str[i + 1].islower()) or \
> +               c_fun_str[i - 1].isdigit():

Indentation looks odd.

> +                new_name += '_'
>          new_name += c
>      return new_name.lstrip('_').upper()

Those are minor, so feel free to add:

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]