summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/xkbcommon/src/x11/util.c
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2018-10-16 12:09:10 +0200
committerGatis Paeglis <gatis.paeglis@qt.io>2018-10-17 08:49:53 +0000
commit76c762558a4f31d030cf55dacf0e1913db5c6d60 (patch)
treeb97b13a026bd798706a820d5fa4d90ee5408cc79 /src/3rdparty/xkbcommon/src/x11/util.c
parentaa633ff276e593af227d7c4a84db230382185490 (diff)
3rdparty/xkbcommon: update bundled version 0.4.1 -> 0.8.2
0.8.2 + subsequent commits up to 31f1f355700870c6615399fbfa7934934b3a9a57. There were couple commits after 0.8.2. Mostly minor stuff, with 2 exceptions: fix off-by-one error in xkb_file_type_to_string() and undefined behavior in src/x11/keymap.c We currently don't use any of the features added in later releases of libxkbcommon, therefore the minimal required version in src/gui/configure.json remains the same. [ChangeLog][Third-Party Code] updated bundled libxkbcommon 0.4.1 -> 0.8.2 (up to 31f1f355700870c6615399fbfa7934934b3a9a57) Task-number: QTBUG-71109 Change-Id: Ia03c3dc31c5f39e78dcb5915a45e82797b065ccb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/3rdparty/xkbcommon/src/x11/util.c')
-rw-r--r--src/3rdparty/xkbcommon/src/x11/util.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/3rdparty/xkbcommon/src/x11/util.c b/src/3rdparty/xkbcommon/src/x11/util.c
index 7659c711a2..c41f1d6cd9 100644
--- a/src/3rdparty/xkbcommon/src/x11/util.c
+++ b/src/3rdparty/xkbcommon/src/x11/util.c
@@ -159,9 +159,10 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn,
{
enum { SIZE = 128 };
xcb_get_atom_name_cookie_t cookies[SIZE];
+ const size_t num_batches = ROUNDUP(count, SIZE) / SIZE;
/* Send and collect the atoms in batches of reasonable SIZE. */
- for (size_t batch = 0; batch <= count / SIZE; batch++) {
+ for (size_t batch = 0; batch < num_batches; batch++) {
const size_t start = batch * SIZE;
const size_t stop = min((batch + 1) * SIZE, count);
@@ -195,15 +196,12 @@ adopt_atoms(struct xkb_context *ctx, xcb_connection_t *conn,
/*
* If we don't discard the uncollected replies, they just
- * sit there waiting. Sad.
+ * sit in the XCB queue waiting forever. Sad.
*/
err_discard:
- for (size_t j = i + 1; j < stop; j++) {
- if (from[j] != XCB_ATOM_NONE) {
- reply = xcb_get_atom_name_reply(conn, cookies[j % SIZE], NULL);
- free(reply);
- }
- }
+ for (size_t j = i + 1; j < stop; j++)
+ if (from[j] != XCB_ATOM_NONE)
+ xcb_discard_reply(conn, cookies[j % SIZE].sequence);
return false;
}
}