summaryrefslogtreecommitdiffstats
path: root/generator.py
diff options
context:
space:
mode:
authorMartin Kletzander <mkletzan@redhat.com>2012-03-22 12:33:35 +0100
committerEric Blake <eblake@redhat.com>2012-03-26 14:45:22 -0600
commita8e031a749d4e67a27cb2004b7c50f0456ecc401 (patch)
treec28bf861d9a399304d639c4e15268613a65613e4 /generator.py
parentdc2f75d35a6461c896a738d092dc973067d0dbd4 (diff)
downloadlibvirt-python-split-a8e031a749d4e67a27cb2004b7c50f0456ecc401.tar.gz
libvirt-python-split-a8e031a749d4e67a27cb2004b7c50f0456ecc401.tar.xz
libvirt-python-split-a8e031a749d4e67a27cb2004b7c50f0456ecc401.zip
Cleanup for a return statement in source files
Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
Diffstat (limited to 'generator.py')
-rwxr-xr-xgenerator.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/generator.py b/generator.py
index cb55740..9530867 100755
--- a/generator.py
+++ b/generator.py
@@ -589,7 +589,7 @@ def print_function_wrapper(module, name, output, export, include):
args[1][0])
else:
c_call = "\n %s(%s);\n" % (name, c_call);
- ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
+ ret_convert = " Py_INCREF(Py_None);\n return Py_None;\n"
elif py_types.has_key(ret[0]):
(f, t, n, c) = py_types[ret[0]]
c_return = " %s c_retval;\n" % (ret[0])
@@ -598,13 +598,13 @@ def print_function_wrapper(module, name, output, export, include):
else:
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
- ret_convert = ret_convert + " return(py_retval);\n"
+ ret_convert = ret_convert + " return py_retval;\n"
elif py_return_types.has_key(ret[0]):
(f, t, n, c) = py_return_types[ret[0]]
c_return = " %s c_retval;\n" % (ret[0])
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
- ret_convert = ret_convert + " return(py_retval);\n"
+ ret_convert = ret_convert + " return py_retval;\n"
else:
if skipped_types.has_key(ret[0]):
return 0
@@ -663,7 +663,7 @@ def print_function_wrapper(module, name, output, export, include):
if format != "":
output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
(format, format_args))
- output.write(" return(NULL);\n")
+ output.write(" return NULL;\n")
if c_convert != "":
output.write(c_convert + "\n")