diff --git a/CHANGES.current b/CHANGES.current index ee19fa356..46e4c5d46 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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. diff --git a/Source/DOH/string.c b/Source/DOH/string.c index 1588da181..e783858a6 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -64,7 +64,6 @@ static int String_dump(DOH *so, DOH *out) { * ----------------------------------------------------------------------------- */ static DOH *CopyString(DOH *so) { - int max; String *str; String *s = (String *) ObjData(so); str = (String *) DohMalloc(sizeof(String)); @@ -74,10 +73,9 @@ static DOH *CopyString(DOH *so) { 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;