aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi-visit.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r--scripts/qapi-visit.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index e9d0584c78..5160d83c4f 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -159,9 +159,9 @@ for o, a in opts:
elif o in ("-o", "--output-dir"):
output_dir = a + "/"
elif o in ("-c", "--source"):
- do_h = True
- elif o in ("-h", "--header"):
do_c = True
+ elif o in ("-h", "--header"):
+ do_h = True
if not do_c and not do_h:
do_c = True
@@ -177,13 +177,11 @@ except os.error, e:
raise
def maybe_open(really, name, opt):
- class Null(object):
- def write(self, str):
- pass
- def read(self):
- return ''
if really:
return open(name, opt)
+ else:
+ import StringIO
+ return StringIO.StringIO()
fdef = maybe_open(do_c, c_file, 'w')
fdecl = maybe_open(do_h, h_file, 'w')