[svn:parrot] r46176 - branches/codestring/src/pmc

coke at svn.parrot.org coke at svn.parrot.org
Fri Apr 30 05:41:45 UTC 2010


Author: coke
Date: Fri Apr 30 05:41:44 2010
New Revision: 46176
URL: https://trac.parrot.org/parrot/changeset/46176

Log:
Avoid creating a new pmc that we were just leaking anyway.

Reduce, reuse, recycle. (revert)

Modified:
   branches/codestring/src/pmc/codestring.pmc

Modified: branches/codestring/src/pmc/codestring.pmc
==============================================================================
--- branches/codestring/src/pmc/codestring.pmc	Fri Apr 30 05:36:18 2010	(r46175)
+++ branches/codestring/src/pmc/codestring.pmc	Fri Apr 30 05:41:44 2010	(r46176)
@@ -225,11 +225,12 @@
 
 
     VTABLE void set_string_native(STRING *value) {
-        /* create a new StringBuilder */
-        PMC *strings = pmc_new(INTERP, enum_class_ResizablePMCArray);
-        VTABLE_push_string(INTERP, strings, value);
+        /* reuse our old stringBuilder */
+        PMC *strings;
 
-        SET_ATTR_strings(INTERP, SELF, strings);
+        GET_ATTR_strings(INTERP, SELF, strings);
+        VTABLE_set_integer_native(INTERP, strings, 0);
+        VTABLE_push_string(INTERP, strings, value);
     }
 
 /*


More information about the parrot-commits mailing list