From: <wsf...@us...> - 2007-03-23 22:12:12
|
Revision: 9657 http://swig.svn.sourceforge.net/swig/?rev=9657&view=rev Author: wsfulton Date: 2007-03-23 15:12:10 -0700 (Fri, 23 Mar 2007) Log Message: ----------- String copying patch from Josh Cherry reducing memory consumption by about 25%. Modified Paths: -------------- trunk/CHANGES.current trunk/Source/DOH/string.c Modified: trunk/CHANGES.current =================================================================== --- trunk/CHANGES.current 2007-03-21 21:00:21 UTC (rev 9656) +++ trunk/CHANGES.current 2007-03-23 22:12:10 UTC (rev 9657) @@ -1,6 +1,9 @@ Version 1.3.32 (in progress) ============================ +03/23/2007: wsfulton + String copying patch from Josh Cherry reducing memory consumption by about 25%. + 03/21/2007: wsfulton [Java] Apply patch #1631987 from Ulrik Peterson - bool INOUT typemaps fail on big endian machines. Modified: trunk/Source/DOH/string.c =================================================================== --- trunk/Source/DOH/string.c 2007-03-21 21:00:21 UTC (rev 9656) +++ trunk/Source/DOH/string.c 2007-03-23 22:12:10 UTC (rev 9657) @@ -64,7 +64,6 @@ * ----------------------------------------------------------------------------- */ static DOH *CopyString(DOH *so) { - int max; String *str; String *s = (String *) ObjData(so); str = (String *) DohMalloc(sizeof(String)); @@ -74,10 +73,9 @@ str->file = s->file; if (str->file) Incref(str->file); - max = s->maxsize; - str->str = (char *) DohMalloc(max + 1); - memmove(str->str, s->str, max); - str->maxsize = max; + str->str = (char *) DohMalloc(s->len + 1); + memcpy(str->str, s->str, s->len); + str->maxsize = s->len; str->len = s->len; str->str[str->len] = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |