summaryrefslogtreecommitdiff
path: root/Source/Swig/typemap.c
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2011-10-30 21:51:50 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2011-10-30 21:51:50 +0000
commit24133bacd7ba5a670607a7ce5e7ac9800c99ae1e (patch)
tree4d595ead83b6725fba9374dc403a80741bfe7ebe /Source/Swig/typemap.c
parentd1dc016b685e72647909200eb16b6f51f256be3e (diff)
downloadswig-24133bacd7ba5a670607a7ce5e7ac9800c99ae1e.tar.gz
Remove numerous hard coded 'result' variable name in generated c/c++ wrappers. The variable name is now defined in just one place, making it possible to change the name easily if a target language so wishes - see cwrap.c.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12830 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source/Swig/typemap.c')
-rw-r--r--Source/Swig/typemap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c
index 0d582a157..5b1ced0b5 100644
--- a/Source/Swig/typemap.c
+++ b/Source/Swig/typemap.c
@@ -1390,6 +1390,7 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
* If f and actioncode are NULL, then the caller is just looking to attach the "out" attributes
* ie, not use the typemap code, otherwise both f and actioncode must be non null. */
if (actioncode) {
+ const String *result_equals = NewStringf("%s = ", Swig_cresult_name());
clname = Copy(actioncode);
/* check that the code in the typemap can be used in this optimal way.
* The code should be in the form "result = ...;\n". We need to extract
@@ -1398,8 +1399,8 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
* hack and circumvents the normal requirement for a temporary variable
* to hold the result returned from a wrapped function call.
*/
- if (Strncmp(clname, "result = ", 9) == 0) {
- int numreplacements = Replace(clname, "result = ", "", DOH_REPLACE_ID_BEGIN);
+ if (Strncmp(clname, result_equals, 9) == 0) {
+ int numreplacements = Replace(clname, result_equals, "", DOH_REPLACE_ID_BEGIN);
if (numreplacements == 1) {
numreplacements = Replace(clname, ";\n", "", DOH_REPLACE_ID_END);
if (numreplacements == 1) {