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 <[email protected]> > ---
> + 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 <[email protected]>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
