[Xcb] [PATCH proto 1/3] Track pad count at the module level

Ran Benita ran234 at gmail.com
Wed Jan 15 14:02:16 PST 2014


On Tue, Jan 14, 2014 at 03:41:22PM -0500, Peter Harris wrote:
> If the pad count is reset for each bitcase, the names will collide
> in the encompasing switch struct.

Hi Peter,

Thanks for cleaning this up. Nice and simple.

For the series (including the libxcb patch):
Reviewed-By: Ran Benita <ran234 at gmail.com>

And for the xkb bits:
Tested-By: Ran Benita <ran234 at gmail.com>

There are a few more alignment_pad hacks around, but I guess you know
about them.

Ran

> Signed-off-by: Peter Harris <pharris at opentext.com>
> ---
>  xcbgen/state.py  | 1 +
>  xcbgen/xtypes.py | 8 ++++----
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/xcbgen/state.py b/xcbgen/state.py
> index 10a8722..52b8d8d 100644
> --- a/xcbgen/state.py
> +++ b/xcbgen/state.py
> @@ -93,6 +93,7 @@ class Module(object):
>      # Recursively resolve all types
>      def resolve(self):
>          for (name, item) in self.all:
> +            self.pads = 0
>              item.resolve(self)
>  
>      # Call all the output methods
> diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
> index 5f45723..e9596a9 100644
> --- a/xcbgen/xtypes.py
> +++ b/xcbgen/xtypes.py
> @@ -296,16 +296,15 @@ class ComplexType(Type):
>      def resolve(self, module):
>          if self.resolved:
>              return
> -        pads = 0
>          enum = None
>  
>          # Resolve all of our field datatypes.
>          for child in list(self.elt):
>              if child.tag == 'pad':
> -                field_name = 'pad' + str(pads)
> +                field_name = 'pad' + str(module.pads)
>                  fkey = 'CARD8'
>                  type = PadType(child)
> -                pads = pads + 1
> +                module.pads = module.pads + 1
>                  visible = False
>              elif child.tag == 'field':
>                  field_name = child.get('name')
> @@ -397,7 +396,6 @@ class SwitchType(ComplexType):
>      def resolve(self, module):
>          if self.resolved:
>              return
> -#        pads = 0
>  
>          parents = list(self.parents) + [self]
>  
> @@ -560,6 +558,8 @@ class Reply(ComplexType):
>      def resolve(self, module):
>          if self.resolved:
>              return
> +        # Reset pads count
> +        module.pads = 0
>          # Add the automatic protocol fields
>          self.fields.append(Field(tcard8, tcard8.name, 'response_type', False, True, True))
>          self.fields.append(_placeholder_byte)
> -- 
> 1.8.5.2
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list