[Xcb] [PATCH libxcb v3 4/5] Code generator: Use xcb_send_request_with_fds()

Uli Schlachter psychon at znc.in
Mon May 18 12:46:24 PDT 2015


Signed-off-by: Uli Schlachter <psychon at znc.in>
---
v2: Python3 compatibility

 src/c_client.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/c_client.py b/src/c_client.py
index e55fc3c..370885d 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -2298,6 +2298,9 @@ def _c_request_helper(self, name, void, regular, aux=False, reply_fds=False):
         _c('    unsigned int i;')
         _c('    unsigned int xcb_tmp_len;')
         _c('    char *xcb_tmp;')
+    num_fds = len([field for field in param_fields if field.isfd])
+    if num_fds > 0:
+        _c('    int fds[%d];' % (num_fds))
     _c('')
 
     # fixed size fields
@@ -2400,9 +2403,12 @@ def _c_request_helper(self, name, void, regular, aux=False, reply_fds=False):
     _c('')
     for field in param_fields:
         if field.isfd:
-            _c('    xcb_send_fd(c, %s);', field.c_field_name)
+            _c('    fds[%d] = %s;', num_fds, field.c_field_name)
 
-    _c('    xcb_ret.sequence = xcb_send_request(c, %s, xcb_parts + 2, &xcb_req);', func_flags)
+    if num_fds == 0:
+        _c('    xcb_ret.sequence = xcb_send_request(c, %s, xcb_parts + 2, &xcb_req);', func_flags)
+    else:
+        _c('    xcb_ret.sequence = xcb_send_request_with_fds(c, %s, xcb_parts + 2, &xcb_req, %d, fds);', func_flags, num_fds)
 
     # free dyn. all. data, if any
     for f in free_calls:
-- 
2.1.4



More information about the Xcb mailing list