From afc015217221acd8667a96111b147f3a742a2c4e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 18 Aug 2022 19:12:42 -0700 Subject: Variable scope reductions as suggested by cppcheck Signed-off-by: Alan Coopersmith --- src/XTest.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/XTest.c') diff --git a/src/XTest.c b/src/XTest.c index e534ee4..2e53700 100644 --- a/src/XTest.c +++ b/src/XTest.c @@ -99,10 +99,11 @@ XTestQueryExtension (Display *dpy, int *major_return, int *minor_return) { XExtDisplayInfo *info = find_display (dpy); - register xXTestGetVersionReq *req; xXTestGetVersionReply rep; if (XextHasExtension(info)) { + xXTestGetVersionReq *req; + LockDisplay(dpy); GetReq(XTestGetVersion, req); req->reqType = info->codes->major_opcode; @@ -259,7 +260,6 @@ send_axes( int n_axes) { deviceValuator ev; - int n; req->deviceid |= MORE_EVENTS; req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2); @@ -267,7 +267,7 @@ send_axes( ev.deviceid = dev->device_id; ev.first_valuator = first_axis; while (n_axes > 0) { - n = n_axes > 6 ? 6 : n_axes; + int n = n_axes > 6 ? 6 : n_axes; ev.num_valuators = n; switch (n) { case 6: @@ -433,11 +433,10 @@ Status XTestDiscard(Display *dpy) { Bool something; - register char *ptr; LockDisplay(dpy); if ((something = (dpy->bufptr != dpy->buffer))) { - for (ptr = dpy->buffer; + for (char *ptr = dpy->buffer; ptr < dpy->bufptr; ptr += (((xReq *)ptr)->length << 2)) dpy->request--; -- cgit v1.2.3