From: Federico Simoncelli <fsimonce@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Federico Simoncelli <fsimonce@redhat.com>,
lcapitulino@redhat.com
Subject: [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case
Date: Thu, 15 Mar 2012 15:45:59 +0000 [thread overview]
Message-ID: <1331826359-13398-1-git-send-email-fsimonce@redhat.com> (raw)
In-Reply-To: <1331819618-12481-1-git-send-email-fsimonce@redhat.com>
This allows qapi commands and types with dots (downstream QMP extensions
containing fully qualified domain names).
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
---
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('*')
def c_list_type(name):
return '%sList' % name
--
1.7.1
next prev parent reply other threads:[~2012-03-15 15:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-15 13:53 [Qemu-devel] [PATCH] qapi: escaping the dots in c_var Federico Simoncelli
2012-03-15 14:51 ` Michael Roth
2012-03-15 15:03 ` Luiz Capitulino
2012-03-15 15:42 ` Michael Roth
2012-03-15 15:45 ` Federico Simoncelli [this message]
2012-03-16 19:16 ` [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case Luiz Capitulino
2012-03-20 13:54 ` [Qemu-devel] [PATCH v3] qapi: add c_fun to escape function names Federico Simoncelli
2012-03-23 20:38 ` Luiz Capitulino
2012-03-26 20:07 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331826359-13398-1-git-send-email-fsimonce@redhat.com \
--to=fsimonce@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).