diff options
author | Uli Schlachter <psychon@znc.in> | 2015-04-22 09:26:05 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2015-06-12 09:39:13 +0200 |
commit | 658fb4a5f0050db68fdf092936afe596412ef5f7 (patch) | |
tree | 0ec0ffc3c7b9beef4ea03c27574f0d4b069663f3 | |
parent | b15aa6bd4efde784e546d168bb23b8a8e816e85b (diff) |
Code generator: Use xcb_send_request_with_fds()
Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r-- | src/c_client.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/c_client.py b/src/c_client.py index 9a7c67c..70f8429 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -2297,6 +2297,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 @@ -2397,11 +2400,16 @@ def _c_request_helper(self, name, void, regular, aux=False, reply_fds=False): # no padding necessary - _serialize() keeps track of padding automatically _c('') + fd_index = 0 for field in param_fields: if field.isfd: - _c(' xcb_send_fd(c, %s);', field.c_field_name) + _c(' fds[%d] = %s;', fd_index, field.c_field_name) + fd_index = fd_index + 1 - _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: |