Bug 573306 – Relax callback grouping detection rules
authorAndreas Rottmann <a.rottmann@gmx.at>
Thu, 26 Feb 2009 20:17:39 +0000 (21:17 +0100)
committerAndreas Rottmann <a.rottmann@gmx.at>
Thu, 26 Feb 2009 20:17:39 +0000 (21:17 +0100)
Make the callback grouping heuristic more lax: consider all pointer
parameters ending in 'data' to be the user_data parameter (instead of
requiring an exact 'user_data' name).

Signed-off-by: Andreas Rottmann <a.rottmann@gmx.at>
giscanner/transformer.py

index eb76f83..8e3219a 100644 (file)
@@ -237,7 +237,7 @@ class Transformer(object):
 
     def _handle_closure(self, param, closure_idx, closure_param):
         if (closure_param.type.name == 'any' and
-            closure_param.name == 'user_data'):
+            closure_param.name.endswith('data')):
             param.closure_name = closure_param.name
             param.closure_index = closure_idx
             return True
@@ -261,9 +261,9 @@ class Transformer(object):
             # group with the callback param
             j = i + 1
             if j == len(params):
-                continue # no more args -> nothing to group look
-            # at the param directly following for either a closure
-            # or a destroy; only one of these will fire
+                continue # no more args -> nothing to group
+            # look at the param directly following for either a
+            # closure or a destroy; only one of these will fire
             had_closure = self._handle_closure(param, j, params[j])
             had_destroy = self._handle_destroy(param, j, params[j])
             j += 1