[svn:parrot] r48857 - trunk/src/pmc
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Wed Sep 8 15:13:33 UTC 2010
Author: nwellnhof
Date: Wed Sep 8 15:13:32 2010
New Revision: 48857
URL: https://trac.parrot.org/parrot/changeset/48857
Log:
[pmc] Never allocate empty strings in StringBuilder
Modified:
trunk/src/pmc/stringbuilder.pmc
Modified: trunk/src/pmc/stringbuilder.pmc
==============================================================================
--- trunk/src/pmc/stringbuilder.pmc Wed Sep 8 15:07:52 2010 (r48856)
+++ trunk/src/pmc/stringbuilder.pmc Wed Sep 8 15:13:32 2010 (r48857)
@@ -63,6 +63,9 @@
VTABLE void init_int(INTVAL initial_size) {
STRING * const buffer = mem_gc_allocate_zeroed_typed(INTERP, STRING);
+ if (initial_size < INITIAL_STRING_CAPACITY)
+ initial_size = INITIAL_STRING_CAPACITY;
+
buffer->encoding = Parrot_default_encoding_ptr;
buffer->_buflen = initial_size;
buffer->_bufstart = buffer->strstart
More information about the parrot-commits
mailing list