Author: Armin Rigo <[email protected]>
Branch: static-callback
Changeset: r2381:05685f1b6781
Date: 2015-11-13 13:19 +0100
http://bitbucket.org/cffi/cffi/changeset/05685f1b6781/

Log:    fix

diff --git a/cffi/parse_c_type.h b/cffi/parse_c_type.h
--- a/cffi/parse_c_type.h
+++ b/cffi/parse_c_type.h
@@ -168,7 +168,7 @@
     void *reserved;
 };
 
-extern void _cffi_call_python(struct _cffi_callpy_s *, void *);
+extern void _cffi_call_python(struct _cffi_callpy_s *, char *);
 
 
 #ifdef _CFFI_INTERNAL
diff --git a/cffi/recompiler.py b/cffi/recompiler.py
--- a/cffi/recompiler.py
+++ b/cffi/recompiler.py
@@ -1161,17 +1161,16 @@
         prnt()
         #
         # Write the implementation of the functions declared above
-        for (tp, name), sig in zip(self._callpy, function_sigs):
-            prnt('static %s' % sig)
+        for j in range(len(self._callpy)):
+            tp, name = self._callpy[j]
+            prnt('static %s' % function_sigs[j])
             prnt('{')
             prnt('  uint64_t a[%d];' % max(len(tp.args), 1))
             prnt('  char *p = (char *)a;')
             for i, type in enumerate(tp.args):
                 prnt('  *(%s)(p + %d) = a%d;' % (type.get_c_name('*'), i*8, i))
-            prnt('  _cffi_call_python(_cffi_callpys + 0, a);')
-            if isinstance(tp.result, model.VoidType):
-                prnt('  (void)p;')
-            else:
+            prnt('  _cffi_call_python(_cffi_callpys + %d, p);' % j)
+            if not isinstance(tp.result, model.VoidType):
                 prnt('  return *(%s)p;' % (tp.result.get_c_name('*'),))
             prnt('}')
             prnt()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to