[Xcb] [PATCH libxcb 18/18] c_client.py: make condition easier to follow in _c_complex()

Christian Linhart chris at DemoRecorder.com
Thu Oct 16 02:52:02 PDT 2014


Very nice simplification.

The new code does the same as the old code because fixed_size has no side-effects.
( the rest is correct due to boolean algebra )

Reviewed-by: Christian Linhart <chris at demorecorder.com>


On 10/12/14 20:58, Ran Benita wrote:
> Signed-off-by: Ran Benita <ran234 at gmail.com>
> ---
>  src/c_client.py | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/c_client.py b/src/c_client.py
> index bb2de13..d77c836 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -1716,9 +1716,7 @@ def _c_complex(self, force_packed = False):
>      maxtypelen = 0
>  
>      for field in self.fields:
> -        if not field.type.fixed_size() and not self.is_switch and not self.is_union:
> -            continue
> -        if field.wire:
> +        if field.wire and (field.type.fixed_size() or self.is_switch or self.is_union):
>              struct_fields.append(field)
>  
>      for field in struct_fields:



More information about the Xcb mailing list