Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r66695:413e9b331b21
Date: 2013-08-29 16:40 -0700
http://bitbucket.org/pypy/pypy/changeset/413e9b331b21/

Log:    code simplication

diff --git a/pypy/module/cppyy/capi/builtin_capi.py 
b/pypy/module/cppyy/capi/builtin_capi.py
--- a/pypy/module/cppyy/capi/builtin_capi.py
+++ b/pypy/module/cppyy/capi/builtin_capi.py
@@ -552,10 +552,3 @@
     charp = rffi.str2charp(svalue)
     _c_assign2stdstring(cppobject, charp)
     rffi.free_charp(charp)
-_c_free_stdstring = rffi.llexternal(
-    "cppyy_free_stdstring",
-    [C_OBJECT], lltype.Void,
-    threadsafe=ts_helper,
-    compilation_info=backend.eci)
-def c_free_stdstring(space, cppobject):
-    _c_free_stdstring(cppobject)
diff --git a/pypy/module/cppyy/capi/loadable_capi.py 
b/pypy/module/cppyy/capi/loadable_capi.py
--- a/pypy/module/cppyy/capi/loadable_capi.py
+++ b/pypy/module/cppyy/capi/loadable_capi.py
@@ -215,7 +215,6 @@
             'charp2stdstring'          : ([c_ccharp],                 
c_object),
             'stdstring2stdstring'      : ([c_object],                 
c_object),
             'assign2stdstring'         : ([c_object, c_ccharp],       c_void),
-            'free_stdstring'           : ([c_object],                 c_void),
         }
 
 def load_reflection_library(space):
@@ -507,8 +506,6 @@
 def c_assign2stdstring(space, cppobject, svalue):
     args = [_Arg(l=cppobject), _Arg(s=svalue)]
     call_capi(space, 'assign2stdstring', args)
-def c_free_stdstring(space, cppobject):
-    call_capi(space, 'free_stdstring', [_Arg(l=cppobject)])
 
 # loadable-capi-specific pythonizations (none, as the capi isn't known until 
runtime)
 def register_pythonizations(space):
diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -523,7 +523,7 @@
             InstanceConverter.to_memory(self, space, w_obj, w_value, offset)
 
     def free_argument(self, space, arg, call_local):
-        capi.c_free_stdstring(space, rffi.cast(capi.C_OBJECT, 
rffi.cast(rffi.VOIDPP, arg)[0]))
+        capi.c_destruct(space, self.cppclass, rffi.cast(capi.C_OBJECT, 
rffi.cast(rffi.VOIDPP, arg)[0]))
 
 class StdStringRefConverter(InstancePtrConverter):
     _immutable_fields_ = ['cppclass']
diff --git a/pypy/module/cppyy/include/capi.h b/pypy/module/cppyy/include/capi.h
--- a/pypy/module/cppyy/include/capi.h
+++ b/pypy/module/cppyy/include/capi.h
@@ -113,7 +113,6 @@
     cppyy_object_t cppyy_charp2stdstring(const char* str);
     cppyy_object_t cppyy_stdstring2stdstring(cppyy_object_t ptr);
     void cppyy_assign2stdstring(cppyy_object_t ptr, const char* str);
-    void cppyy_free_stdstring(cppyy_object_t ptr);
 
 #ifdef __cplusplus
 }
diff --git a/pypy/module/cppyy/src/cintcwrapper.cxx 
b/pypy/module/cppyy/src/cintcwrapper.cxx
--- a/pypy/module/cppyy/src/cintcwrapper.cxx
+++ b/pypy/module/cppyy/src/cintcwrapper.cxx
@@ -978,10 +978,6 @@
    *((std::string*)ptr) = str;
 }
 
-void cppyy_free_stdstring(cppyy_object_t ptr) {
-    delete (std::string*)ptr;
-}
-
 
 void* cppyy_load_dictionary(const char* lib_name) {
     if (0 <= gSystem->Load(lib_name))
diff --git a/pypy/module/cppyy/src/reflexcwrapper.cxx 
b/pypy/module/cppyy/src/reflexcwrapper.cxx
--- a/pypy/module/cppyy/src/reflexcwrapper.cxx
+++ b/pypy/module/cppyy/src/reflexcwrapper.cxx
@@ -624,7 +624,3 @@
 void cppyy_assign2stdstring(cppyy_object_t ptr, const char* str) {
     *((std::string*)ptr) = str;
 }
-
-void cppyy_free_stdstring(cppyy_object_t ptr) {
-    delete (std::string*)ptr;
-}
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to