[pypy-commit] cffi default: Simplification.
arigo
noreply at buildbot.pypy.org
Sat Nov 17 17:58:33 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1046:1a9236dde7a7
Date: 2012-11-17 17:58 +0100
http://bitbucket.org/cffi/cffi/changeset/1a9236dde7a7/
Log: Simplification.
diff --git a/cffi/api.py b/cffi/api.py
--- a/cffi/api.py
+++ b/cffi/api.py
@@ -59,9 +59,7 @@
if name.startswith('RTLD_'):
setattr(self, name, getattr(backend, name))
#
- self.cdef('typedef struct _IO_FILE FILE;')
- del self._cdefsources[:]
- #
+ self._parser._declarations['typedef FILE'] = model.file_type
BVoidP = self._get_cached_btype(model.voidp_type)
if isinstance(backend, types.ModuleType):
# _cffi_backend: attach these constants to the class
diff --git a/cffi/model.py b/cffi/model.py
--- a/cffi/model.py
+++ b/cffi/model.py
@@ -367,15 +367,21 @@
self.enumvalues)
-def unknown_type(name):
- tp = StructType('$%s' % name, None, None, None)
+def unknown_type(name, structname=None):
+ if structname is None:
+ structname = '$%s' % name
+ tp = StructType(structname, None, None, None)
tp.forcename = name
return tp
-def unknown_ptr_type(name):
- tp = StructType('*$%s' % name, None, None, None)
+def unknown_ptr_type(name, structname=None):
+ if structname is None:
+ structname = '*$%s' % name
+ tp = StructType(structname, None, None, None)
return NamedPointerType(tp, name)
+file_type = unknown_type('FILE', '_IO_FILE')
+
def global_cache(srctype, ffi, funcname, *args):
try:
return ffi._backend.__typecache[args]
More information about the pypy-commit
mailing list