qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, sw@weilnetz.de,
	stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [PATCH 1/2] qapi: fix guardname generation
Date: Tue, 29 Nov 2011 16:47:48 -0600	[thread overview]
Message-ID: <1322606869-25865-1-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <4ED3F1C3.4060601@weilnetz.de>

Fix a bug in handling dotted paths, and exclude directory prefixes
from generated guardnames to avoid odd/pseudo-random guardnames in
generated headers.
---
 scripts/qapi.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 5299976..6e05469 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -200,6 +200,7 @@ def basename(filename):
     return filename.split("/")[-1]
 
 def guardname(filename):
-    if filename.startswith('./'):
-        filename = filename[2:]
-    return filename.replace("/", "_").replace("-", "_").split(".")[0].upper() + '_H'
+    guard = basename(filename).rsplit(".", 1)[0]
+    for substr in [".", " ", "-"]:
+        guard = guard.replace(substr, "_")
+    return guard.upper() + '_H'
-- 
1.7.4.1

  parent reply	other threads:[~2011-11-29 22:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 17:27 [Qemu-devel] [PATCH] fix out of tree build Stefano Stabellini
2011-11-23  9:48 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-11-28 18:34 ` [Qemu-devel] " Stefan Weil
2011-11-28 18:45   ` Anthony Liguori
2011-11-28 20:40   ` Stefan Weil
2011-11-29 16:23     ` Stefano Stabellini
2011-11-29 22:47     ` Michael Roth [this message]
2011-11-29 22:47       ` [Qemu-devel] [PATCH 2/2] Makefile: use full path for qapi-generated directory Michael Roth
2011-11-30  9:10         ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2011-11-30 13:03           ` Stefano Stabellini
2011-11-30 19:59             ` Stefan Weil
2011-12-01 15:19               ` Stefano Stabellini
2011-12-01 16:05                 ` Michael Roth
2011-12-01 18:11                 ` Stefan Weil
2011-12-01 18:28                   ` Anthony Liguori
2011-12-01 18:42                     ` Stefano Stabellini
2011-12-01 19:12                       ` Michael Roth
2011-12-01 18:38                   ` Stefano Stabellini
2011-11-30  9:08       ` [Qemu-devel] [Qemu-trivial] [PATCH 1/2] qapi: fix guardname generation Stefan Hajnoczi

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=1322606869-25865-1-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=sw@weilnetz.de \
    /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).