[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] header_wrappers.py generates 'return' for 'void' callback

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-12-29 08:48:27 CET

On Fri, 29 Dec 2006, Kouhei Sutou wrote:
...
> [[
> Do not generate 'return' for callbacks return 'void'.
>
> * build/generator/swig/header_wrappers.py
> (_write_callback): Add 'return' only if return_type is not 'void'.
> ]]
...
> Index: build/generator/swig/header_wrappers.py
> ===================================================================
> --- build/generator/swig/header_wrappers.py (revision 22832)
> +++ build/generator/swig/header_wrappers.py (working copy)
> @@ -84,11 +84,15 @@
> param_names = string.join(self._re_param_names.findall(params), ", ")
> params = "%s _obj, %s" % (type, params)
>
> + invoke_callback = "%s(%s)" % (callee, param_names)
> + if return_type != "void":
> + invoke_callback = "return %s" % (invoke_callback)
                                         ^ ^
You don't need the parenthesis around (invoke_callback).

> # Write out the declaration
> self.ofile.write(
> "static %s %s_invoke_%s(\n" % (return_type, module, function) +
> " %s) {\n" % params +
> - " return %s(%s);\n" % (callee, param_names) +
> + " %s;\n" % (invoke_callback) +
> "}\n\n")

Other than that, looks good. +1 to commit.

  • application/pgp-signature attachment: stored
Received on Fri Dec 29 08:49:50 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.