Revision 19bf7c87 scripts/qapi-visit.py

b/scripts/qapi-visit.py
159 159
    elif o in ("-o", "--output-dir"):
160 160
        output_dir = a + "/"
161 161
    elif o in ("-c", "--source"):
162
        do_h = True
163
    elif o in ("-h", "--header"):
164 162
        do_c = True
163
    elif o in ("-h", "--header"):
164
        do_h = True
165 165

  
166 166
if not do_c and not do_h:
167 167
    do_c = True
......
177 177
        raise
178 178

  
179 179
def maybe_open(really, name, opt):
180
    class Null(object):
181
        def write(self, str):
182
            pass
183
        def read(self):
184
            return ''
185 180
    if really:
186 181
        return open(name, opt)
182
    else:
183
        import StringIO
184
        return StringIO.StringIO()
187 185

  
188 186
fdef = maybe_open(do_c, c_file, 'w')
189 187
fdecl = maybe_open(do_h, h_file, 'w')

Also available in: Unified diff