[pypy-commit] pypy default: copy a tad less in rbuilder, only copy the amount of data we have, not the amount we allocated

alex_gaynor noreply at buildbot.pypy.org
Thu Oct 20 03:20:29 CEST 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r48251:48ae76147f6f
Date: 2011-10-19 21:18 -0400
http://bitbucket.org/pypy/pypy/changeset/48ae76147f6f/

Log:	copy a tad less in rbuilder, only copy the amount of data we have,
	not the amount we allocated

diff --git a/pypy/rpython/lltypesystem/rbuilder.py b/pypy/rpython/lltypesystem/rbuilder.py
--- a/pypy/rpython/lltypesystem/rbuilder.py
+++ b/pypy/rpython/lltypesystem/rbuilder.py
@@ -29,7 +29,7 @@
         except OverflowError:
             raise MemoryError
         newbuf = mallocfn(new_allocated)
-        copycontentsfn(ll_builder.buf, newbuf, 0, 0, ll_builder.allocated)
+        copycontentsfn(ll_builder.buf, newbuf, 0, 0, ll_builder.used)
         ll_builder.buf = newbuf
         ll_builder.allocated = new_allocated
     return func_with_new_name(stringbuilder_grow, name)
@@ -56,7 +56,7 @@
 class BaseStringBuilderRepr(AbstractStringBuilderRepr):
     def empty(self):
         return nullptr(self.lowleveltype.TO)
-    
+
     @classmethod
     def ll_new(cls, init_size):
         if init_size < 0 or init_size > MAX:


More information about the pypy-commit mailing list