[Spice-devel] [Warning cleanup 2/4] Use an alternate local variable than sin, as it conflicts with the math library. Eliminates gcc -Wshadow warnings.

Jeremy White jwhite at codeweavers.com
Mon Aug 6 13:37:06 PDT 2012


---
 src/spiceqxl_display.c |   42 +++++++++++++++++++++---------------------
 src/spiceqxl_inputs.c  |   32 ++++++++++++++++----------------
 2 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/spiceqxl_display.c b/src/spiceqxl_display.c
index b1ce557..b6ae73d 100644
--- a/src/spiceqxl_display.c
+++ b/src/spiceqxl_display.c
@@ -85,10 +85,10 @@ QXLDevMemSlot slot = {
 // TODO - reall dprint, this is just to get it compiling
 #define dprint(qxl, lvl, fmt, ...) printf(fmt, __VA_ARGS__)
 
-static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
+static void interface_attach_worker(QXLInstance *instance, QXLWorker *qxl_worker)
 {
     static int count = 0;
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
 
     if (++count > 1) {
         dprint(qxl, 0, "%s ignored\n", __FUNCTION__);
@@ -99,26 +99,26 @@ static void interface_attach_worker(QXLInstance *sin, QXLWorker *qxl_worker)
     qxl->worker = qxl_worker;
 }
 
-static void interface_set_compression_level(QXLInstance *sin, int level)
+static void interface_set_compression_level(QXLInstance *instance, int level)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
 
     dprint(qxl, 1, "%s: %d\n", __FUNCTION__, level);
     qxl->shadow_rom.compression_level = level;
     qxl->rom->compression_level = level;
 }
 
-static void interface_set_mm_time(QXLInstance *sin, uint32_t mm_time)
+static void interface_set_mm_time(QXLInstance *instance, uint32_t mm_time)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
 
     qxl->shadow_rom.mm_clock = mm_time;
     qxl->rom->mm_clock = mm_time;
 }
 
-static void interface_get_init_info(QXLInstance *sin, QXLDevInitInfo *info)
+static void interface_get_init_info(QXLInstance *instance, QXLDevInitInfo *info)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
 
     dprint(qxl, 1, "%s:\n", __FUNCTION__);
     info->memslot_gen_bits = MEMSLOT_GENERATION_BITS;
@@ -140,9 +140,9 @@ void qxl_send_events(qxl_screen_t *qxl, int events)
 }
 
 /* called from spice server thread context only */
-static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
+static int interface_get_command(QXLInstance *instance, struct QXLCommandExt *ext)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     QXLRam *ram = get_ram_header(qxl);
     QXLCommandRing *ring;
     QXLCommand *cmd;
@@ -170,9 +170,9 @@ static int interface_get_command(QXLInstance *sin, struct QXLCommandExt *ext)
 }
 
 /* called from spice server thread context only */
-static int interface_req_cmd_notification(QXLInstance *sin)
+static int interface_req_cmd_notification(QXLInstance *instance)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     QXLRam *header = get_ram_header(qxl);
     int wait = 1;
 
@@ -218,10 +218,10 @@ static inline void qxl_push_free_res(qxl_screen_t *qxl, int flush)
 }
 
 /* called from spice server thread context only */
-static void interface_release_resource(QXLInstance *sin,
+static void interface_release_resource(QXLInstance *instance,
                                        struct QXLReleaseInfoExt ext)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     QXLRam *ram = get_ram_header(qxl);
     QXLReleaseRing *ring;
     uint64_t *item, id;
@@ -249,9 +249,9 @@ static void interface_release_resource(QXLInstance *sin,
 }
 
 /* called from spice server thread context only */
-static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *ext)
+static int interface_get_cursor_command(QXLInstance *instance, struct QXLCommandExt *ext)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     QXLCursorRing *ring;
     QXLCommand *cmd;
     QXLRam *ram = get_ram_header(qxl);
@@ -276,9 +276,9 @@ static int interface_get_cursor_command(QXLInstance *sin, struct QXLCommandExt *
 }
 
 /* called from spice server thread context only */
-static int interface_req_cursor_notification(QXLInstance *sin)
+static int interface_req_cursor_notification(QXLInstance *instance)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     QXLRam *ram = get_ram_header(qxl);
     int wait = 1;
 
@@ -287,16 +287,16 @@ static int interface_req_cursor_notification(QXLInstance *sin)
 }
 
 /* called from spice server thread context */
-static void interface_notify_update(QXLInstance *sin, uint32_t update_id)
+static void interface_notify_update(QXLInstance *instance, uint32_t update_id)
 {
     fprintf(stderr, "%s: abort()\n", __FUNCTION__);
     abort();
 }
 
 /* called from spice server thread context only */
-static int interface_flush_resources(QXLInstance *sin)
+static int interface_flush_resources(QXLInstance *instance)
 {
-    qxl_screen_t *qxl = container_of(sin, qxl_screen_t, display_sin);
+    qxl_screen_t *qxl = container_of(instance, qxl_screen_t, display_sin);
     int ret;
 
     dprint(qxl, 1, "free: guest flush (have %d)\n", qxl->num_free_res);
diff --git a/src/spiceqxl_inputs.c b/src/spiceqxl_inputs.c
index 62ef19f..9d612a3 100644
--- a/src/spiceqxl_inputs.c
+++ b/src/spiceqxl_inputs.c
@@ -179,8 +179,8 @@ static int xspice_keyboard_proc(DeviceIntPtr pDevice, int onoff)
 /* from spice-input.c */
 /* keyboard bits */
 
-static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag);
-static uint8_t kbd_get_leds(SpiceKbdInstance *sin);
+static void kbd_push_key(SpiceKbdInstance *instance, uint8_t frag);
+static uint8_t kbd_get_leds(SpiceKbdInstance *instance);
 
 static const SpiceKbdInterface kbd_interface = {
     .base.type          = SPICE_INTERFACE_KEYBOARD,
@@ -222,9 +222,9 @@ static uint8_t escaped_map[256] = {
     [0x5d] = 135,//KEY_Menu,
 };
 
-static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
+static void kbd_push_key(SpiceKbdInstance *instance, uint8_t frag)
 {
-    XSpiceKbd *kbd = container_of(sin, XSpiceKbd, sin);
+    XSpiceKbd *kbd = container_of(instance, XSpiceKbd, sin);
     int is_down;
 
     if (frag == 224) {
@@ -246,9 +246,9 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
     xf86PostKeyboardEvent(kbd->pInfo->dev, frag, is_down);
 }
 
-static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
+static uint8_t kbd_get_leds(SpiceKbdInstance *instance)
 {
-    XSpiceKbd *kbd = container_of(sin, XSpiceKbd, sin);
+    XSpiceKbd *kbd = container_of(instance, XSpiceKbd, sin);
 
     return kbd->ledstate;
 }
@@ -263,13 +263,13 @@ typedef struct XSpicePointer {
     InputInfoPtr     pInfo; /* xf86 device handle to post events */
 } XSpicePointer;
 
-static void mouse_motion(SpiceMouseInstance *sin, int dx, int dy, int dz,
+static void mouse_motion(SpiceMouseInstance *instance, int dx, int dy, int dz,
                          uint32_t buttons_state)
 {
     // TODO
 }
 
-static void mouse_buttons(SpiceMouseInstance *sin, uint32_t buttons_state)
+static void mouse_buttons(SpiceMouseInstance *instance, uint32_t buttons_state)
 {
     // TODO
 }
@@ -283,9 +283,9 @@ static const SpiceMouseInterface mouse_interface = {
     .buttons            = mouse_buttons,
 };
 
-static void tablet_set_logical_size(SpiceTabletInstance* sin, int width, int height)
+static void tablet_set_logical_size(SpiceTabletInstance* instance, int width, int height)
 {
-    XSpicePointer *pointer = container_of(sin, XSpicePointer, tablet);
+    XSpicePointer *pointer = container_of(instance, XSpicePointer, tablet);
 
     if (height < 16) {
         height = 16;
@@ -297,19 +297,19 @@ static void tablet_set_logical_size(SpiceTabletInstance* sin, int width, int hei
     pointer->height = height;
 }
 
-static void tablet_position(SpiceTabletInstance* sin, int x, int y,
+static void tablet_position(SpiceTabletInstance* instance, int x, int y,
                             uint32_t buttons_state)
 {
-    XSpicePointer *pointer = container_of(sin, XSpicePointer, tablet);
+    XSpicePointer *pointer = container_of(instance, XSpicePointer, tablet);
 
     // TODO: don't ignore buttons_state
     xf86PostMotionEvent(pointer->pInfo->dev, 1, 0, 2, x, y);
 }
 
-static void tablet_buttons(SpiceTabletInstance *sin,
+static void tablet_buttons(SpiceTabletInstance *instance,
                            uint32_t buttons_state)
 {
-    XSpicePointer *pointer = container_of(sin, XSpicePointer, tablet);
+    XSpicePointer *pointer = container_of(instance, XSpicePointer, tablet);
     static uint32_t old_buttons_state = 0;
     int i;
 
@@ -330,11 +330,11 @@ static void tablet_buttons(SpiceTabletInstance *sin,
     old_buttons_state = buttons_state;
 }
 
-static void tablet_wheel(SpiceTabletInstance* sin, int wheel,
+static void tablet_wheel(SpiceTabletInstance* instance, int wheel,
                          uint32_t buttons_state)
 {
     // convert wheel into fourth and fifth buttons
-    tablet_buttons(sin, buttons_state
+    tablet_buttons(instance, buttons_state
                         | (wheel > 0 ? (1<<4) : 0)
                         | (wheel < 0 ? (1<<3) : 0));
 }
-- 
1.7.10.4





More information about the Spice-devel mailing list