@@ -1026,13 +1026,15 @@ def dump_typedef(self, ln, proto):
10261026 """
10271027 Stores a typedef inside self.entries array.
10281028 """
1029-
1030- typedef_type = r'((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
1029+ #
1030+ # We start by looking for function typedefs.
1031+ #
1032+ typedef_type = r'typedef((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
10311033 typedef_ident = r'\*?\s*(\w\S+)\s*'
10321034 typedef_args = r'\s*\((.*)\);'
10331035
1034- typedef1 = KernRe (r'typedef' + typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args )
1035- typedef2 = KernRe (r'typedef' + typedef_type + typedef_ident + typedef_args )
1036+ typedef1 = KernRe (typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args )
1037+ typedef2 = KernRe (typedef_type + typedef_ident + typedef_args )
10361038
10371039 # Parse function typedef prototypes
10381040 for r in [typedef1 , typedef2 ]:
@@ -1048,16 +1050,16 @@ def dump_typedef(self, ln, proto):
10481050 f"expecting prototype for typedef { self .entry .identifier } . Prototype was for typedef { declaration_name } instead\n " )
10491051 return
10501052
1051- decl_type = 'function'
1052- self .create_parameter_list (ln , decl_type , args , ',' , declaration_name )
1053+ self .create_parameter_list (ln , 'function' , args , ',' , declaration_name )
10531054
1054- self .output_declaration (decl_type , declaration_name ,
1055+ self .output_declaration ('function' , declaration_name ,
10551056 typedef = True ,
10561057 functiontype = return_type ,
10571058 purpose = self .entry .declaration_purpose )
10581059 return
1059-
1060- # Parse simple typedefs
1060+ #
1061+ # Not a function, try to parse a simple typedef.
1062+ #
10611063 r = KernRe (r'typedef.*\s+(\w+)\s*;' )
10621064 if r .match (proto ):
10631065 declaration_name = r .group (1 )
0 commit comments