[pypy-svn] r31810 - pypy/branch/no-zeroing-assumption-2/pypy/rpython/lltypesystem

mwh at codespeak.net mwh at codespeak.net
Tue Aug 29 23:04:38 CEST 2006


Author: mwh
Date: Tue Aug 29 23:04:37 2006
New Revision: 31810

Modified:
   pypy/branch/no-zeroing-assumption-2/pypy/rpython/lltypesystem/rstr.py
Log:
add a mallocstr function, but don't use it yet because the annotation support i
need isn't on the branch yet...


Modified: pypy/branch/no-zeroing-assumption-2/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/branch/no-zeroing-assumption-2/pypy/rpython/lltypesystem/rstr.py	(original)
+++ pypy/branch/no-zeroing-assumption-2/pypy/rpython/lltypesystem/rstr.py	Tue Aug 29 23:04:37 2006
@@ -1,6 +1,7 @@
 from weakref import WeakValueDictionary
 from pypy.annotation.pairtype import pairtype
 from pypy.rpython.error import TyperError
+from pypy.rpython.objectmodel import malloc_zero_filled
 from pypy.rpython.robject import PyObjRepr, pyobj_repr
 from pypy.rpython.rarithmetic import _hash_string
 from pypy.rpython.rmodel import inputconst, IntegerRepr
@@ -108,7 +109,11 @@
                                  resulttype=pyobj_repr,
                                  _callable= lambda chars, sz: pyobjectptr(''.join(chars)))
 
-
+def mallocstr(length):
+    r = malloc(STR, length)
+    if not malloc_zero_filled:
+        r.hash = 0
+    return r
 
 # ____________________________________________________________
 #



More information about the Pypy-commit mailing list