[Xcb] [PATCH libxcb 10/18] c_client.py: use pattern matching with enumerate()
Ran Benita
ran234 at gmail.com
Sun Oct 12 11:58:12 PDT 2014
Signed-off-by: Ran Benita <ran234 at gmail.com>
---
src/c_client.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/c_client.py b/src/c_client.py
index 0488ea5..4c19722 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -483,8 +483,7 @@ def _c_helper_resolve_field_names (prefix):
all_fields = {}
tmp_prefix = []
# look for fields in the remaining containers
- for idx, p in enumerate(prefix):
- name, sep, obj = p
+ for (idx, (name, sep, obj)) in enumerate(prefix):
if ''==sep:
# sep can be preset in prefix, if not, make a sensible guess
sep = '.' if (obj.is_switch or obj.is_case_or_bitcase) else '->'
@@ -833,7 +832,7 @@ def _c_serialize_helper_fields_fixed_size(context, self, field,
if not self.is_case_or_bitcase:
code_lines.append('%s /* %s.%s */' % (space, self.c_type, field.c_field_name))
else:
- scoped_name = [p[2].c_type if idx==0 else p[0] for idx, p in enumerate(prefix)]
+ scoped_name = [obj.c_type if idx==0 else name for idx, (name, sep, obj) in enumerate(prefix)]
typename = ".".join(scoped_name)
code_lines.append('%s /* %s.%s */' % (space, typename, field.c_field_name))
@@ -1965,7 +1964,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
_c(' void *xcb_aux = 0;')
- for idx, f in enumerate(serial_fields):
+ for idx, _ in enumerate(serial_fields):
if aux:
_c(' void *xcb_aux%d = 0;' % (idx))
if list_with_var_size_elems:
--
2.1.2
More information about the Xcb
mailing list