[Xcb] [PATCH libxcb 16/18] c_client.py: spell out keyword arguments in c_request() for clarity

Christian Linhart chris at DemoRecorder.com
Sat Oct 25 08:42:06 PDT 2014


This helps readability.

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

The long parameter lists hint to some design problem however.
( The generator should have been written in OO-design using classes instead of just a collection of many functions )

Maybe we'll have time for fixing that design issue, 
after we'll have reviewed and merged all pending patches into upstream.

Chris



On 10/12/14 20:58, Ran Benita wrote:
> Signed-off-by: Ran Benita <ran234 at gmail.com>
> ---
>  src/c_client.py | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/c_client.py b/src/c_client.py
> index d561e04..e22dc52 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -2749,11 +2749,11 @@ def c_request(self, name):
>          _c_complex(self.reply)
>          # Request prototypes
>          has_fds = _c_reply_has_fds(self.reply)
> -        _c_request_helper(self, name, self.c_cookie_type, False, True, False, has_fds)
> -        _c_request_helper(self, name, self.c_cookie_type, False, False, False, has_fds)
> +        _c_request_helper(self, name, self.c_cookie_type, void=False, regular=True, aux=False, reply_fds=has_fds)
> +        _c_request_helper(self, name, self.c_cookie_type, void=False, regular=False, aux=False, reply_fds=has_fds)
>          if self.c_need_aux:
> -            _c_request_helper(self, name, self.c_cookie_type, False, True, True, has_fds)
> -            _c_request_helper(self, name, self.c_cookie_type, False, False, True, has_fds)
> +            _c_request_helper(self, name, self.c_cookie_type, void=False, regular=True, aux=True, reply_fs=has_fds)
> +            _c_request_helper(self, name, self.c_cookie_type, void=False, regular=False, aux=True, reply_fs=has_fds)
>          # Reply accessors
>          _c_accessors(self.reply, name + ('reply',), name)
>          _c_reply(self, name)
> @@ -2761,16 +2761,16 @@ def c_request(self, name):
>              _c_reply_fds(self, name)
>      else:
>          # Request prototypes
> -        _c_request_helper(self, name, 'xcb_void_cookie_t', True, False)
> -        _c_request_helper(self, name, 'xcb_void_cookie_t', True, True)
> +        _c_request_helper(self, name, 'xcb_void_cookie_t', void=True, regular=False)
> +        _c_request_helper(self, name, 'xcb_void_cookie_t', void=True, regular=True)
>          if self.c_need_aux:
> -            _c_request_helper(self, name, 'xcb_void_cookie_t', True, False, True)
> -            _c_request_helper(self, name, 'xcb_void_cookie_t', True, True, True)
> +            _c_request_helper(self, name, 'xcb_void_cookie_t', void=True, regular=False, aux=True)
> +            _c_request_helper(self, name, 'xcb_void_cookie_t', void=True, regular=True, aux=True)
>  
>      # We generate the manpage afterwards because _c_type_setup has been called.
>      # TODO: what about aux helpers?
>      cookie_type = self.c_cookie_type if self.reply else 'xcb_void_cookie_t'
> -    _man_request(self, name, cookie_type, not self.reply, False)
> +    _man_request(self, name, cookie_type, void=not self.reply, aux=False)
>  
>  def c_event(self, name):
>      '''



More information about the Xcb mailing list