Message ID | 1331819618-12481-1-git-send-email-fsimonce@redhat.com |
---|---|
State | New |
Headers | show |
On Thu, Mar 15, 2012 at 01:53:38PM +0000, Federico Simoncelli wrote: > This allows qapi commands and types with dots. > > Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> > --- > scripts/qapi.py | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 6e05469..4090c55 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -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('*') What are you looking to use this for? The general rule so far has been to always use "-" as the word delimiter. > > def c_list_type(name): > return '%sList' % name > -- > 1.7.1 > >
On Thu, 15 Mar 2012 09:51:10 -0500 Michael Roth <mdroth@linux.vnet.ibm.com> wrote: > On Thu, Mar 15, 2012 at 01:53:38PM +0000, Federico Simoncelli wrote: > > This allows qapi commands and types with dots. > > > > Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> > > --- > > scripts/qapi.py | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/scripts/qapi.py b/scripts/qapi.py > > index 6e05469..4090c55 100644 > > --- a/scripts/qapi.py > > +++ b/scripts/qapi.py > > @@ -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('*') > > What are you looking to use this for? The general rule so far has been to > always use "-" as the word delimiter. Downstream extensions of QMP (commands, events, etc) are fully qualified domain names, and hence contain dots.
On Thu, Mar 15, 2012 at 12:03:30PM -0300, Luiz Capitulino wrote: > On Thu, 15 Mar 2012 09:51:10 -0500 > Michael Roth <mdroth@linux.vnet.ibm.com> wrote: > > > On Thu, Mar 15, 2012 at 01:53:38PM +0000, Federico Simoncelli wrote: > > > This allows qapi commands and types with dots. > > > > > > Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> > > > --- > > > scripts/qapi.py | 2 +- > > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > > > diff --git a/scripts/qapi.py b/scripts/qapi.py > > > index 6e05469..4090c55 100644 > > > --- a/scripts/qapi.py > > > +++ b/scripts/qapi.py > > > @@ -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('*') > > > > What are you looking to use this for? The general rule so far has been to > > always use "-" as the word delimiter. > > Downstream extensions of QMP (commands, events, etc) are fully qualified > domain names, and hence contain dots. > Ahh, thanks. Patch looks good :) Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
diff --git a/scripts/qapi.py b/scripts/qapi.py index 6e05469..4090c55 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -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('*') def c_list_type(name): return '%sList' % name
This allows qapi commands and types with dots. Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> --- scripts/qapi.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)