Commits

Armin Rigo committed 1a9236d

Simplification.

Comments (0)

Files changed (2)

             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
                                           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]