diff --git a/CHANGES.current b/CHANGES.current index 1b1352296..345257e62 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,6 +1,29 @@ Version 1.3.39 (in progress) ============================ +2008-02-12: wsfulton + Remove unnecessary temporary variable when wrapping return values that are references. + Example of generated code for wrapping: + + struct XYZ { + std::string& refReturn(); + }; + + used to be: + + std::string *result = 0 ; + ... + { + std::string &_result_ref = (arg1)->refReturn(); + result = (std::string *) &_result_ref; + } + + Now it is: + + std::string *result = 0 ; + ... + result = (std::string *) &(arg1)->refReturn(); + 2008-02-08: bhy Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from the length of the buffer to the number of items in the buffer. diff --git a/Source/Swig/cwrap.c b/Source/Swig/cwrap.c index 49d2c1e9b..3ed736f54 100644 --- a/Source/Swig/cwrap.c +++ b/Source/Swig/cwrap.c @@ -260,10 +260,9 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or break; case T_REFERENCE: { - String *str = SwigType_str(t, "_result_ref"); - Printf(fcall, "{\n"); - Printf(fcall, "%s = ", str); - Delete(str); + String *lstr = SwigType_lstr(t, 0); + Printf(fcall, "%s = (%s) &", name, lstr); + Delete(lstr); } break; case T_USER: @@ -290,12 +289,6 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or Append(fcall, ";"); } - if (SwigType_type(t) == T_REFERENCE) { - String *lstr = SwigType_lstr(t, 0); - Printf(fcall, "\n%s = (%s) &_result_ref;\n", name, lstr); - Append(fcall, "}"); - Delete(lstr); - } return fcall; }