From 0c936d90894fd639b38c488c5a30fa948194f140 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 23 Apr 2016 02:34:52 +0200 Subject: [PATCH] Simplify and inline functionWrapperAddCPPResult() This function seemed to be doing a few unnecessary things, e.g. it resolved the typedefs which doesn't seem to be necessary and the test for member pointer seems to be useless too. Just add a local "cppresult" directly in the caller instead of using a separate function to do all this. --- Source/Modules/c.cxx | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/Source/Modules/c.cxx b/Source/Modules/c.cxx index 916875a3b..10cdd50fc 100644 --- a/Source/Modules/c.cxx +++ b/Source/Modules/c.cxx @@ -740,20 +740,6 @@ ready: Delete(over_suffix); } - static void functionWrapperAddCPPResult(Wrapper *wrapper, const SwigType *type, const String *tm) - { - SwigType *cpptype; - SwigType *tdtype = SwigType_typedef_resolve_all(tm); - if (tdtype) - cpptype = tdtype; - else - cpptype = (SwigType*)tm; - if (SwigType_ismemberpointer(type)) - Wrapper_add_local(wrapper, "cppresult", SwigType_str(type, "cppresult")); - else - Wrapper_add_local(wrapper, "cppresult", SwigType_str(cpptype, "cppresult")); - } - String *get_wrapper_func_return_type(output_target target, Node *n) { SwigType *type = Getattr(n, "type"); @@ -932,9 +918,8 @@ ready: // add variable for holding result of original function 'cppresult' if (!is_void_return && !is_ctor) { - String *tm; - if ((tm = Swig_typemap_lookup("cppouttype", n, "", 0))) { - functionWrapperAddCPPResult(wrapper, type, tm); + if (String *tm = Swig_typemap_lookup("cppouttype", n, "", 0)) { + Wrapper_add_local(wrapper, "cppresult", SwigType_str(tm, "cppresult")); return_object = checkAttribute(n, "tmap:cppouttype:retobj", "1"); } else {