[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case |
Date: |
Fri, 16 Mar 2012 16:16:48 -0300 |
On Thu, 15 Mar 2012 15:45:59 +0000
Federico Simoncelli <address@hidden> wrote:
> This allows qapi commands and types with dots (downstream QMP extensions
> containing fully qualified domain names).
>
> Signed-off-by: Federico Simoncelli <address@hidden>
> ---
> scripts/qapi.py | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 6e05469..b1173bf 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -111,7 +111,7 @@ def de_camel_case(name):
> for ch in name:
> if ch.isupper() and new_name:
> new_name += '_'
> - if ch == '-':
> + if ch == '-' or ch == '.':
> new_name += '_'
> else:
> new_name += ch.lower()
> @@ -131,7 +131,7 @@ def camel_case(name):
> return new_name
>
> def c_var(name):
> - return '_'.join(name.split('-')).lstrip("*")
> + return name.replace('-', '_').replace('.', '_').lstrip('*')
This changes a struct member access from 'foo.bar' to 'foo_bar' in the
generated qapi-visit.c.
Please, test build your patches against master before posting.
>
> def c_list_type(name):
> return '%sList' % name