From: Peter Hutterer Date: Mon, 25 Jan 2021 07:12:12 +0000 (+1000) Subject: tools/record: use a pointer to the libinput fd poll entry X-Git-Tag: 1.16.901~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b8ad776248b365d7557dec9efe4e0cfd77a8e33;p=platform%2Fupstream%2Flibinput.git tools/record: use a pointer to the libinput fd poll entry No functional changes, this makes the code slightly more readable, especially once we start adding more "special" fds. Signed-off-by: Peter Hutterer --- diff --git a/tools/libinput-record.c b/tools/libinput-record.c index e64f56d5..254a54b5 100644 --- a/tools/libinput-record.c +++ b/tools/libinput-record.c @@ -2116,6 +2116,7 @@ mainloop(struct record_context *ctx) bool autorestart = (ctx->timeout > 0); struct pollfd fds[ctx->ndevices + 2]; struct pollfd *signal_fd = &fds[0]; + struct pollfd *libinput_fd = NULL; unsigned int nfds = 0; struct record_device *d = NULL; sigset_t mask; @@ -2141,9 +2142,8 @@ mainloop(struct record_context *ctx) nfds++; if (ctx->libinput) { - fds[1].fd = libinput_get_fd(ctx->libinput); - nfds++; - assert(nfds == 2); + libinput_fd = &fds[nfds++]; + libinput_fd->fd = libinput_get_fd(ctx->libinput); } list_for_each(d, &ctx->devices, link) { @@ -2236,7 +2236,7 @@ mainloop(struct record_context *ctx) /* This shouldn't pull any events off unless caused * by libinput-internal timeouts (e.g. tapping) */ - if (ctx->libinput && fds[1].revents) { + if (ctx->libinput && libinput_fd->revents) { size_t count, offset; libinput_dispatch(ctx->libinput);