[PATCH 16/18] test/xi2: Clean up -Wshadow warnings

Keith Packard keithp at keithp.com
Mon Jan 13 10:17:56 PST 2014


protocol-common declares a bunch of pretty generic names; fix shadows
of these names.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 test/xi2/protocol-common.c              | 66 ++++++++++++++++-----------------
 test/xi2/protocol-common.h              |  2 +-
 test/xi2/protocol-xipassivegrabdevice.c |  8 ++--
 test/xi2/protocol-xiquerydevice.c       |  2 +-
 test/xi2/protocol-xiqueryversion.c      |  4 +-
 5 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index e171115..9a429e4 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -41,7 +41,7 @@ WindowRec root;
 WindowRec window;
 static ClientRec server_client;
 
-void *userdata;
+void *global_userdata;
 
 static void
 fake_init_sprite(DeviceIntPtr dev)
@@ -136,34 +136,34 @@ struct devices
 init_devices(void)
 {
     ClientRec client;
-    struct devices devices;
+    struct devices local_devices;
 
     client = init_client(0, NULL);
 
-    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
+    AllocDevicePair(&client, "Virtual core", &local_devices.vcp, &local_devices.vck,
                     CorePointerProc, CoreKeyboardProc, TRUE);
-    inputInfo.pointer = devices.vcp;
+    inputInfo.pointer = local_devices.vcp;
 
-    inputInfo.keyboard = devices.vck;
-    ActivateDevice(devices.vcp, FALSE);
-    ActivateDevice(devices.vck, FALSE);
-    EnableDevice(devices.vcp, FALSE);
-    EnableDevice(devices.vck, FALSE);
+    inputInfo.keyboard = local_devices.vck;
+    ActivateDevice(local_devices.vcp, FALSE);
+    ActivateDevice(local_devices.vck, FALSE);
+    EnableDevice(local_devices.vcp, FALSE);
+    EnableDevice(local_devices.vck, FALSE);
 
-    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd,
+    AllocDevicePair(&client, "", &local_devices.mouse, &local_devices.kbd,
                     TestPointerProc, CoreKeyboardProc, FALSE);
-    ActivateDevice(devices.mouse, FALSE);
-    ActivateDevice(devices.kbd, FALSE);
-    EnableDevice(devices.mouse, FALSE);
-    EnableDevice(devices.kbd, FALSE);
+    ActivateDevice(local_devices.mouse, FALSE);
+    ActivateDevice(local_devices.kbd, FALSE);
+    EnableDevice(local_devices.mouse, FALSE);
+    EnableDevice(local_devices.kbd, FALSE);
 
-    devices.num_devices = 4;
-    devices.num_master_devices = 2;
+    local_devices.num_devices = 4;
+    local_devices.num_master_devices = 2;
 
-    fake_init_sprite(devices.mouse);
-    fake_init_sprite(devices.vcp);
+    fake_init_sprite(local_devices.mouse);
+    fake_init_sprite(local_devices.vcp);
 
-    return devices;
+    return local_devices;
 }
 
 /* Create minimal client, with the given buffer and len as request buffer */
@@ -187,20 +187,20 @@ init_client(int len, void *data)
 }
 
 void
-init_window(WindowPtr window, WindowPtr parent, int id)
+init_window(WindowPtr local_window, WindowPtr parent, int id)
 {
-    memset(window, 0, sizeof(*window));
+    memset(local_window, 0, sizeof(*local_window));
 
-    window->drawable.id = id;
+    local_window->drawable.id = id;
     if (parent) {
-        window->drawable.x = 30;
-        window->drawable.y = 50;
-        window->drawable.width = 100;
-        window->drawable.height = 200;
+        local_window->drawable.x = 30;
+        local_window->drawable.y = 50;
+        local_window->drawable.width = 100;
+        local_window->drawable.height = 200;
     }
-    window->parent = parent;
-    window->optional = calloc(1, sizeof(WindowOptRec));
-    assert(window->optional);
+    local_window->parent = parent;
+    local_window->optional = calloc(1, sizeof(WindowOptRec));
+    assert(local_window->optional);
 }
 
 extern DevPrivateKeyRec miPointerScreenKeyRec;
@@ -208,18 +208,18 @@ extern DevPrivateKeyRec miPointerPrivKeyRec;
 
 /* Needed for the screen setup, otherwise we crash during sprite initialization */
 static Bool
-device_cursor_init(DeviceIntPtr dev, ScreenPtr screen)
+device_cursor_init(DeviceIntPtr dev, ScreenPtr local_screen)
 {
     return TRUE;
 }
 
 static void
-device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr screen)
+device_cursor_cleanup(DeviceIntPtr dev, ScreenPtr local_screen)
 {
 }
 
 static Bool
-set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event)
+set_cursor_pos(DeviceIntPtr dev, ScreenPtr local_screen, int x, int y, Bool event)
 {
     return TRUE;
 }
@@ -264,5 +264,5 @@ __wrap_WriteToClient(ClientPtr client, int len, void *data)
 {
     assert(reply_handler != NULL);
 
-    (*reply_handler) (client, len, data, userdata);
+    (*reply_handler) (client, len, data, global_userdata);
 }
diff --git a/test/xi2/protocol-common.h b/test/xi2/protocol-common.h
index d303068..f850478 100644
--- a/test/xi2/protocol-common.h
+++ b/test/xi2/protocol-common.h
@@ -91,7 +91,7 @@ extern struct devices devices;
 /**
  * test-specific userdata, passed into the reply handler.
  */
-extern void *userdata;
+extern void *global_userdata;
 
 /**
  * The reply handler called from WriteToClient. Set this handler if you need
diff --git a/test/xi2/protocol-xipassivegrabdevice.c b/test/xi2/protocol-xipassivegrabdevice.c
index 84b386b..1e2341e 100644
--- a/test/xi2/protocol-xipassivegrabdevice.c
+++ b/test/xi2/protocol-xipassivegrabdevice.c
@@ -136,7 +136,7 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
                             int error, int errval)
 {
     int rc;
-    int modifiers;
+    int local_modifiers;
 
     rc = ProcXIPassiveGrabDevice(&client_request);
     assert(rc == error);
@@ -151,12 +151,12 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
     swapl(&req->cursor);
     swapl(&req->detail);
     swaps(&req->deviceid);
-    modifiers = req->num_modifiers;
+    local_modifiers = req->num_modifiers;
     swaps(&req->num_modifiers);
     swaps(&req->mask_len);
 
-    while (modifiers--) {
-        CARD32 *mod = ((CARD32 *) (req + 1)) + modifiers;
+    while (local_modifiers--) {
+        CARD32 *mod = ((CARD32 *) (req + 1)) + local_modifiers;
 
         swapl(mod);
     }
diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c
index c066daa..deef1f1 100644
--- a/test/xi2/protocol-xiquerydevice.c
+++ b/test/xi2/protocol-xiquerydevice.c
@@ -312,7 +312,7 @@ test_XIQueryDevice(void)
     struct test_data data;
 
     reply_handler = reply_XIQueryDevice;
-    userdata = &data;
+    global_userdata = &data;
     request_init(&request, XIQueryDevice);
 
     printf("Testing XIAllDevices.\n");
diff --git a/test/xi2/protocol-xiqueryversion.c b/test/xi2/protocol-xiqueryversion.c
index ed75c89..3749b30 100644
--- a/test/xi2/protocol-xiqueryversion.c
+++ b/test/xi2/protocol-xiqueryversion.c
@@ -113,7 +113,7 @@ request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
 
     request_init(&request, XIQueryVersion);
     client = init_client(request.length, &request);
-    userdata = (void *) &versions;
+    global_userdata = (void *) &versions;
 
     /* Change the server to support smaj.smin */
     XIVersion.major_version = smaj;
@@ -206,7 +206,7 @@ test_XIQueryVersion_multiple(void)
     XIVersion.minor_version = 2;
 
     reply_handler = reply_XIQueryVersion_multiple;
-    userdata = (void *) &versions;
+    global_userdata = (void *) &versions;
 
     /* run 1 */
 
-- 
1.8.5.2



More information about the xorg-devel mailing list