[pypy-svn] r16662 - in pypy/release/0.7.x/pypy/translator/c: . src

pedronis at codespeak.net pedronis at codespeak.net
Fri Aug 26 18:42:28 CEST 2005


Author: pedronis
Date: Fri Aug 26 18:42:26 2005
New Revision: 16662

Modified:
   pypy/release/0.7.x/pypy/translator/c/extfunc.py
   pypy/release/0.7.x/pypy/translator/c/src/main.h
Log:
prefix some dangerous helpers with _ and add a comment to why they are risky to use.



Modified: pypy/release/0.7.x/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/c/extfunc.py	(original)
+++ pypy/release/0.7.x/pypy/translator/c/extfunc.py	Fri Aug 26 18:42:26 2005
@@ -75,12 +75,19 @@
     def RPyString_New(length=lltype.Signed):
         return lltype.malloc(STR, length)
 
+    # !!!
+    # be extremely careful passing a gc tracked object
+    # from such an helper result to another one
+    # as argument, this could result in leaks
+    # Such result should be only from C code
+    # returned directly as results
+
     p = lltype.Ptr(rlist.LIST_OF_STR)
 
-    def RPyListOfString_New(length=lltype.Signed):
+    def _RPyListOfString_New(length=lltype.Signed):
         return rlist.ll_newlist(p, length)
 
-    def RPyListOfString_SetItem(l=p,
+    def _RPyListOfString_SetItem(l=p,
                                 index=lltype.Signed,
                                 newstring=lltype.Ptr(STR)):
         rlist.ll_setitem_nonneg(l, index, newstring)

Modified: pypy/release/0.7.x/pypy/translator/c/src/main.h
==============================================================================
--- pypy/release/0.7.x/pypy/translator/c/src/main.h	(original)
+++ pypy/release/0.7.x/pypy/translator/c/src/main.h	Fri Aug 26 18:42:26 2005
@@ -12,12 +12,12 @@
     errmsg = RPython_StartupCode();
     if (errmsg) goto error;
 
-    list = RPyListOfString_New(argc);
+    list = _RPyListOfString_New(argc);
     if (RPyExceptionOccurred()) goto error;
     for (i=0; i<argc; i++) {
         RPyString *s = RPyString_FromString(argv[i]);
         if (RPyExceptionOccurred()) goto error;
-        RPyListOfString_SetItem(list, i, s);
+        _RPyListOfString_SetItem(list, i, s);
     }
 
 



More information about the Pypy-commit mailing list