[Xcb] [PATCH libxcb 2/6] generator: fix absname for fields with only iterator function

Ran Benita ran234 at gmail.com
Sun Oct 12 11:24:17 PDT 2014


On Wed, Sep 03, 2014 at 01:22:37PM +0200, Christian Linhart wrote:
> Fix _c_helper_absolute_name for fields which can only be
> accessed with an iterator function.
> These are lists with var-sized structs as members.

This doesn't sound right. Does the caller know how to handle each
iterator? Where it is used? I see that the code is reached, but this
it doesn't seem to reach the generated output anywhere (with this
libxcb+proto patchset), as opposed to the accessors in the `else` branch.

So can we skip this patch? If not, why is it needed?

Ran

> ---
>  src/c_client.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/c_client.py b/src/c_client.py
> index 488f0e6..35c975f 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -464,15 +464,20 @@ def _c_helper_absolute_name(prefix, field=None):
>                  ( field.type.is_list and not field.type.fixed_size() )
>                  or
>                  ( field.prev_varsized_field is not None
>                    or not field.type.fixed_size()
>                  )
>          )
>      ):
> -        prefix_str = field.c_accessor_name + "(" + prefix_str_without_lastsep + ")";
> +        if field.type.is_list and not field.type.member.fixed_size():
> +            #only accessible by iterator
> +            prefix_str = field.c_iterator_name + "(" + prefix_str_without_lastsep + ")";
> +        else:
> +            #only accessible by access function
> +            prefix_str = field.c_accessor_name + "(" + prefix_str_without_lastsep + ")";
>  
>      return prefix_str
>  # _c_absolute_name
>  
>  def _c_helper_field_mapping(complex_type, prefix, flat=False):
>      """
>      generate absolute names, based on prefix, for all fields starting from complex_type
> -- 
> 2.0.1
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list