[spice-server v2 9/9] qxl: Improve 'red' and 'qxl' argument names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All the methods related to QXL command parsing have a 'qxl' argument
which designates the guest side resources, and a 'red' argument, which
designates the spice-server side data which has been parsed from 'qxl'.
When reading random functions in red-parse-qxl.c, it's quite easy to
wonder what a 'red' is if you are not familiar with the convention.
This commit adds a suffix to each of these 'red'/'qxl' variables so that
it's clearer what they are referring to.

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 server/red-parse-qxl.c | 924 ++++++++++++++++++++++++-------------------------
 1 file changed, 462 insertions(+), 462 deletions(-)

diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index afd136e43..22ee2e986 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -116,7 +116,7 @@ static uint8_t *red_linearize_chunk(RedDataChunk *head, size_t size, bool *free_
 
 static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
                                       int memslot_id,
-                                      RedDataChunk *red, QXLDataChunk *qxl)
+                                      RedDataChunk *red_data_chunk, QXLDataChunk *qxl_data_chunk)
 {
     RedDataChunk *red_prev;
     uint64_t data_size = 0;
@@ -125,16 +125,16 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
     QXLPHYSICAL next_chunk;
     unsigned num_chunks = 0;
 
-    red->data_size = qxl->data_size;
-    data_size += red->data_size;
-    red->data = qxl->data;
-    red->prev_chunk = red->next_chunk = NULL;
-    if (!memslot_validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id)) {
-        red->data = NULL;
+    red_data_chunk->data_size = qxl_data_chunk->data_size;
+    data_size += red_data_chunk->data_size;
+    red_data_chunk->data = qxl_data_chunk->data;
+    red_data_chunk->prev_chunk = red_data_chunk->next_chunk = NULL;
+    if (!memslot_validate_virt(slots, (intptr_t)red_data_chunk->data, memslot_id, red_data_chunk->data_size, group_id)) {
+        red_data_chunk->data = NULL;
         return INVALID_SIZE;
     }
 
-    while ((next_chunk = qxl->next_chunk) != 0) {
+    while ((next_chunk = qxl_data_chunk->next_chunk) != 0) {
         /* somebody is trying to use too much memory using a lot of chunks.
          * Or made a circular list of chunks
          */
@@ -144,8 +144,8 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
         }
 
         memslot_id = memslot_get_id(slots, next_chunk);
-        qxl = (QXLDataChunk *)memslot_get_virt(slots, next_chunk, sizeof(*qxl),
-                                               group_id, &error);
+        qxl_data_chunk = (QXLDataChunk *)memslot_get_virt(slots, next_chunk, sizeof(*qxl_data_chunk),
+                                                          group_id, &error);
         if (error)
             goto error;
 
@@ -155,16 +155,16 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
          * All above cases are handled by the check for number
          * of chunks.
          */
-        chunk_data_size = qxl->data_size;
+        chunk_data_size = qxl_data_chunk->data_size;
         if (chunk_data_size == 0)
             continue;
 
-        red_prev = red;
-        red = g_new0(RedDataChunk, 1);
-        red->data_size = chunk_data_size;
-        red->prev_chunk = red_prev;
-        red->data = qxl->data;
-        red_prev->next_chunk = red;
+        red_prev = red_data_chunk;
+        red_data_chunk = g_new0(RedDataChunk, 1);
+        red_data_chunk->data_size = chunk_data_size;
+        red_data_chunk->prev_chunk = red_prev;
+        red_data_chunk->data = qxl_data_chunk->data;
+        red_prev->next_chunk = red_data_chunk;
 
         data_size += chunk_data_size;
         /* this can happen if client is sending nested chunks */
@@ -172,69 +172,69 @@ static size_t red_get_data_chunks_ptr(RedMemSlotInfo *slots, int group_id,
             spice_warning("too much data inside chunks, avoiding DoS\n");
             goto error;
         }
-        if (!memslot_validate_virt(slots, (intptr_t)red->data, memslot_id, red->data_size, group_id))
+        if (!memslot_validate_virt(slots, (intptr_t)red_data_chunk->data, memslot_id, red_data_chunk->data_size, group_id))
             goto error;
     }
 
-    red->next_chunk = NULL;
+    red_data_chunk->next_chunk = NULL;
     return data_size;
 
 error:
-    while (red->prev_chunk) {
-        red_prev = red->prev_chunk;
-        g_free(red);
-        red = red_prev;
+    while (red_data_chunk->prev_chunk) {
+        red_prev = red_data_chunk->prev_chunk;
+        g_free(red_data_chunk);
+        red_data_chunk = red_prev;
     }
-    red->data_size = 0;
-    red->next_chunk = NULL;
-    red->data = NULL;
+    red_data_chunk->data_size = 0;
+    red_data_chunk->next_chunk = NULL;
+    red_data_chunk->data = NULL;
     return INVALID_SIZE;
 }
 
 static size_t red_get_data_chunks(RedMemSlotInfo *slots, int group_id,
-                                  RedDataChunk *red, QXLPHYSICAL addr)
+                                  RedDataChunk *red_data_chunk, QXLPHYSICAL addr)
 {
-    QXLDataChunk *qxl;
+    QXLDataChunk *qxl_data_chunk;
     int error;
     int memslot_id = memslot_get_id(slots, addr);
 
-    qxl = (QXLDataChunk *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_data_chunk = (QXLDataChunk *)memslot_get_virt(slots, addr, sizeof(*qxl_data_chunk), group_id, &error);
     if (error) {
         return INVALID_SIZE;
     }
-    return red_get_data_chunks_ptr(slots, group_id, memslot_id, red, qxl);
+    return red_get_data_chunks_ptr(slots, group_id, memslot_id, red_data_chunk, qxl_data_chunk);
 }
 
-static void red_put_data_chunks(RedDataChunk *red)
+static void red_put_data_chunks(RedDataChunk *red_data_chunk)
 {
     RedDataChunk *tmp;
 
-    red = red->next_chunk;
-    while (red) {
-        tmp = red;
-        red = red->next_chunk;
+    red_data_chunk = red_data_chunk->next_chunk;
+    while (red_data_chunk) {
+        tmp = red_data_chunk;
+        red_data_chunk = red_data_chunk->next_chunk;
         g_free(tmp);
     }
 }
 
-static void red_get_point_ptr(SpicePoint *red, QXLPoint *qxl)
+static void red_get_point_ptr(SpicePoint *red_point, QXLPoint *qxl_point)
 {
-    red->x = qxl->x;
-    red->y = qxl->y;
+    red_point->x = qxl_point->x;
+    red_point->y = qxl_point->y;
 }
 
-static void red_get_point16_ptr(SpicePoint16 *red, QXLPoint16 *qxl)
+static void red_get_point16_ptr(SpicePoint16 *red_point, QXLPoint16 *qxl_point)
 {
-    red->x = qxl->x;
-    red->y = qxl->y;
+    red_point->x = qxl_point->x;
+    red_point->y = qxl_point->y;
 }
 
-void red_get_rect_ptr(SpiceRect *red, const QXLRect *qxl)
+void red_get_rect_ptr(SpiceRect *red_rect, const QXLRect *qxl_rect)
 {
-    red->top    = qxl->top;
-    red->left   = qxl->left;
-    red->bottom = qxl->bottom;
-    red->right  = qxl->right;
+    red_rect->top    = qxl_rect->top;
+    red_rect->left   = qxl_rect->left;
+    red_rect->bottom = qxl_rect->bottom;
+    red_rect->right  = qxl_rect->right;
 }
 
 static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
@@ -245,8 +245,8 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
     SpicePathSeg *seg;
     uint8_t *data;
     bool free_data;
-    QXLPath *qxl;
-    SpicePath *red;
+    QXLPath *qxl_path;
+    SpicePath *red_path;
     size_t size;
     uint64_t mem_size, mem_size2, segment_size;
     int n_segments;
@@ -254,13 +254,13 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
     uint32_t count;
     int error;
 
-    qxl = (QXLPath *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_path = (QXLPath *)memslot_get_virt(slots, addr, sizeof(*qxl_path), group_id, &error);
     if (error) {
         return NULL;
     }
     size = red_get_data_chunks_ptr(slots, group_id,
                                    memslot_get_id(slots, addr),
-                                   &chunks, &qxl->chunk);
+                                   &chunks, &qxl_path->chunk);
     if (size == INVALID_SIZE) {
         return NULL;
     }
@@ -268,7 +268,7 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
     red_put_data_chunks(&chunks);
 
     n_segments = 0;
-    mem_size = sizeof(*red);
+    mem_size = sizeof(*red_path);
 
     start = (QXLPathSeg*)data;
     end = (QXLPathSeg*)(data + size);
@@ -283,16 +283,16 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
         start = (QXLPathSeg*)(&start->points[count]);
     }
 
-    red = g_malloc(mem_size);
-    red->num_segments = n_segments;
+    red_path = g_malloc(mem_size);
+    red_path->num_segments = n_segments;
 
     start = (QXLPathSeg*)data;
     end = (QXLPathSeg*)(data + size);
-    seg = (SpicePathSeg*)&red->segments[n_segments];
+    seg = (SpicePathSeg*)&red_path->segments[n_segments];
     n_segments = 0;
-    mem_size2 = sizeof(*red);
-    while (start+1 < end && n_segments < red->num_segments) {
-        red->segments[n_segments++] = seg;
+    mem_size2 = sizeof(*red_path);
+    while (start+1 < end && n_segments < red_path->num_segments) {
+        red_path->segments[n_segments++] = seg;
         count = start->count;
 
         /* Protect against overflow in size calculations before
@@ -311,20 +311,20 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
         seg = (SpicePathSeg*)(&seg->points[i]);
     }
     /* Ensure guest didn't tamper with segment count */
-    spice_assert(n_segments == red->num_segments);
+    spice_assert(n_segments == red_path->num_segments);
 
     if (free_data) {
         g_free(data);
     }
-    return red;
+    return red_path;
 }
 
 static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
                                           QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
-    QXLClipRects *qxl;
-    SpiceClipRects *red;
+    QXLClipRects *qxl_clip_rects;
+    SpiceClipRects *red_clip_rects;
     QXLRect *start;
     uint8_t *data;
     bool free_data;
@@ -333,38 +333,38 @@ static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
     int error;
     uint32_t num_rects;
 
-    qxl = (QXLClipRects *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_clip_rects = (QXLClipRects *)memslot_get_virt(slots, addr, sizeof(*qxl_clip_rects), group_id, &error);
     if (error) {
         return NULL;
     }
     size = red_get_data_chunks_ptr(slots, group_id,
                                    memslot_get_id(slots, addr),
-                                   &chunks, &qxl->chunk);
+                                   &chunks, &qxl_clip_rects->chunk);
     if (size == INVALID_SIZE) {
         return NULL;
     }
     data = red_linearize_chunk(&chunks, size, &free_data);
     red_put_data_chunks(&chunks);
 
-    num_rects = qxl->num_rects;
+    num_rects = qxl_clip_rects->num_rects;
     /* The cast is needed to prevent 32 bit integer overflows.
      * This check is enough as size is limited to 31 bit
      * by red_get_data_chunks_ptr checks.
      */
     spice_assert((uint64_t) num_rects * sizeof(QXLRect) == size);
     SPICE_VERIFY(sizeof(SpiceRect) == sizeof(QXLRect));
-    red = g_malloc(sizeof(*red) + num_rects * sizeof(SpiceRect));
-    red->num_rects = num_rects;
+    red_clip_rects = g_malloc(sizeof(*red_clip_rects) + num_rects * sizeof(SpiceRect));
+    red_clip_rects->num_rects = num_rects;
 
     start = (QXLRect*)data;
-    for (i = 0; i < red->num_rects; i++) {
-        red_get_rect_ptr(red->rects + i, start++);
+    for (i = 0; i < red_clip_rects->num_rects; i++) {
+        red_get_rect_ptr(red_clip_rects->rects + i, start++);
     }
 
     if (free_data) {
         g_free(data);
     }
-    return red;
+    return red_clip_rects;
 }
 
 static SpiceChunks *red_get_image_data_flat(RedMemSlotInfo *slots, int group_id,
@@ -456,8 +456,8 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
                                  QXLPHYSICAL addr, uint32_t flags, bool is_mask)
 {
     RedDataChunk chunks;
-    QXLImage *qxl;
-    SpiceImage *red = NULL;
+    QXLImage *qxl_image;
+    SpiceImage *red_image = NULL;
     SpicePalette *rp = NULL;
     uint64_t bitmap_size, size;
     uint8_t qxl_flags;
@@ -468,44 +468,44 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
         return NULL;
     }
 
-    qxl = (QXLImage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_image = (QXLImage *)memslot_get_virt(slots, addr, sizeof(*qxl_image), group_id, &error);
     if (error) {
         return NULL;
     }
-    red = g_new0(SpiceImage, 1);
-    red->descriptor.id     = qxl->descriptor.id;
-    red->descriptor.type   = qxl->descriptor.type;
-    red->descriptor.flags = 0;
-    if (qxl->descriptor.flags & QXL_IMAGE_HIGH_BITS_SET) {
-        red->descriptor.flags |= SPICE_IMAGE_FLAGS_HIGH_BITS_SET;
+    red_image = g_new0(SpiceImage, 1);
+    red_image->descriptor.id     = qxl_image->descriptor.id;
+    red_image->descriptor.type   = qxl_image->descriptor.type;
+    red_image->descriptor.flags = 0;
+    if (qxl_image->descriptor.flags & QXL_IMAGE_HIGH_BITS_SET) {
+        red_image->descriptor.flags |= SPICE_IMAGE_FLAGS_HIGH_BITS_SET;
     }
-    if (qxl->descriptor.flags & QXL_IMAGE_CACHE) {
-        red->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
+    if (qxl_image->descriptor.flags & QXL_IMAGE_CACHE) {
+        red_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
     }
-    red->descriptor.width  = qxl->descriptor.width;
-    red->descriptor.height = qxl->descriptor.height;
+    red_image->descriptor.width  = qxl_image->descriptor.width;
+    red_image->descriptor.height = qxl_image->descriptor.height;
 
-    switch (red->descriptor.type) {
+    switch (red_image->descriptor.type) {
     case SPICE_IMAGE_TYPE_BITMAP:
-        red->u.bitmap.format = qxl->bitmap.format;
-        red->u.bitmap.x      = qxl->bitmap.x;
-        red->u.bitmap.y      = qxl->bitmap.y;
-        red->u.bitmap.stride = qxl->bitmap.stride;
-        palette = qxl->bitmap.palette;
-        if (!bitmap_fmt_is_rgb(red->u.bitmap.format) && !palette && !is_mask) {
+        red_image->u.bitmap.format = qxl_image->bitmap.format;
+        red_image->u.bitmap.x      = qxl_image->bitmap.x;
+        red_image->u.bitmap.y      = qxl_image->bitmap.y;
+        red_image->u.bitmap.stride = qxl_image->bitmap.stride;
+        palette = qxl_image->bitmap.palette;
+        if (!bitmap_fmt_is_rgb(red_image->u.bitmap.format) && !palette && !is_mask) {
             spice_warning("guest error: missing palette on bitmap format=%d\n",
-                          red->u.bitmap.format);
+                          red_image->u.bitmap.format);
             goto error;
         }
-        if (red->u.bitmap.x == 0 || red->u.bitmap.y == 0) {
+        if (red_image->u.bitmap.x == 0 || red_image->u.bitmap.y == 0) {
             spice_warning("guest error: zero area bitmap\n");
             goto error;
         }
-        qxl_flags = qxl->bitmap.flags;
+        qxl_flags = qxl_image->bitmap.flags;
         if (qxl_flags & QXL_BITMAP_TOP_DOWN) {
-            red->u.bitmap.flags = SPICE_BITMAP_FLAGS_TOP_DOWN;
+            red_image->u.bitmap.flags = SPICE_BITMAP_FLAGS_TOP_DOWN;
         }
-        if (!bitmap_consistent(&red->u.bitmap)) {
+        if (!bitmap_consistent(&red_image->u.bitmap)) {
             goto error;
         }
         if (palette) {
@@ -534,181 +534,181 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
                     rp->ents[i] = qp->ents[i];
                 }
             }
-            red->u.bitmap.palette = rp;
-            red->u.bitmap.palette_id = rp->unique;
+            red_image->u.bitmap.palette = rp;
+            red_image->u.bitmap.palette_id = rp->unique;
         }
-        bitmap_size = (uint64_t) red->u.bitmap.y * red->u.bitmap.stride;
+        bitmap_size = (uint64_t) red_image->u.bitmap.y * red_image->u.bitmap.stride;
         if (bitmap_size > MAX_DATA_CHUNK) {
             goto error;
         }
         if (qxl_flags & QXL_BITMAP_DIRECT) {
-            red->u.bitmap.data = red_get_image_data_flat(slots, group_id,
-                                                         qxl->bitmap.data,
-                                                         bitmap_size);
+            red_image->u.bitmap.data = red_get_image_data_flat(slots, group_id,
+                                                               qxl_image->bitmap.data,
+                                                               bitmap_size);
         } else {
             size = red_get_data_chunks(slots, group_id,
-                                       &chunks, qxl->bitmap.data);
+                                       &chunks, qxl_image->bitmap.data);
             if (size == INVALID_SIZE || size != bitmap_size) {
                 red_put_data_chunks(&chunks);
                 goto error;
             }
-            red->u.bitmap.data = red_get_image_data_chunked(slots, group_id,
-                                                            &chunks);
+            red_image->u.bitmap.data = red_get_image_data_chunked(slots, group_id,
+                                                                  &chunks);
             red_put_data_chunks(&chunks);
         }
         if (qxl_flags & QXL_BITMAP_UNSTABLE) {
-            red->u.bitmap.data->flags |= SPICE_CHUNKS_FLAGS_UNSTABLE;
+            red_image->u.bitmap.data->flags |= SPICE_CHUNKS_FLAGS_UNSTABLE;
         }
         break;
     case SPICE_IMAGE_TYPE_SURFACE:
-        red->u.surface.surface_id = qxl->surface_image.surface_id;
+        red_image->u.surface.surface_id = qxl_image->surface_image.surface_id;
         break;
     case SPICE_IMAGE_TYPE_QUIC:
-        red->u.quic.data_size = qxl->quic.data_size;
+        red_image->u.quic.data_size = qxl_image->quic.data_size;
         size = red_get_data_chunks_ptr(slots, group_id,
                                        memslot_get_id(slots, addr),
-                                       &chunks, (QXLDataChunk *)qxl->quic.data);
-        if (size == INVALID_SIZE || size != red->u.quic.data_size) {
+                                       &chunks, (QXLDataChunk *)qxl_image->quic.data);
+        if (size == INVALID_SIZE || size != red_image->u.quic.data_size) {
             red_put_data_chunks(&chunks);
             goto error;
         }
-        red->u.quic.data = red_get_image_data_chunked(slots, group_id,
-                                                      &chunks);
+        red_image->u.quic.data = red_get_image_data_chunked(slots, group_id,
+                                                            &chunks);
         red_put_data_chunks(&chunks);
         break;
     default:
-        spice_warning("unknown type %d", red->descriptor.type);
+        spice_warning("unknown type %d", red_image->descriptor.type);
         goto error;
     }
-    return red;
+    return red_image;
 error:
-    g_free(red);
+    g_free(red_image);
     g_free(rp);
     return NULL;
 }
 
-static void red_put_image(SpiceImage *red)
+static void red_put_image(SpiceImage *red_image)
 {
-    if (red == NULL)
+    if (red_image == NULL)
         return;
 
-    switch (red->descriptor.type) {
+    switch (red_image->descriptor.type) {
     case SPICE_IMAGE_TYPE_BITMAP:
-        g_free(red->u.bitmap.palette);
-        spice_chunks_destroy(red->u.bitmap.data);
+        g_free(red_image->u.bitmap.palette);
+        spice_chunks_destroy(red_image->u.bitmap.data);
         break;
     case SPICE_IMAGE_TYPE_QUIC:
-        spice_chunks_destroy(red->u.quic.data);
+        spice_chunks_destroy(red_image->u.quic.data);
         break;
     }
-    g_free(red);
+    g_free(red_image);
 }
 
 static void red_get_brush_ptr(RedMemSlotInfo *slots, int group_id,
-                              SpiceBrush *red, QXLBrush *qxl, uint32_t flags)
+                              SpiceBrush *red_brush, QXLBrush *qxl_brush, uint32_t flags)
 {
-    red->type = qxl->type;
-    switch (red->type) {
+    red_brush->type = qxl_brush->type;
+    switch (red_brush->type) {
     case SPICE_BRUSH_TYPE_SOLID:
         if (flags & QXL_COMMAND_FLAG_COMPAT_16BPP) {
-            red->u.color = color_16_to_32(qxl->u.color);
+            red_brush->u.color = color_16_to_32(qxl_brush->u.color);
         } else {
-            red->u.color = qxl->u.color;
+            red_brush->u.color = qxl_brush->u.color;
         }
         break;
     case SPICE_BRUSH_TYPE_PATTERN:
-        red->u.pattern.pat = red_get_image(slots, group_id, qxl->u.pattern.pat, flags, false);
-        red_get_point_ptr(&red->u.pattern.pos, &qxl->u.pattern.pos);
+        red_brush->u.pattern.pat = red_get_image(slots, group_id, qxl_brush->u.pattern.pat, flags, false);
+        red_get_point_ptr(&red_brush->u.pattern.pos, &qxl_brush->u.pattern.pos);
         break;
     }
 }
 
-static void red_put_brush(SpiceBrush *red)
+static void red_put_brush(SpiceBrush *red_brush)
 {
-    switch (red->type) {
+    switch (red_brush->type) {
     case SPICE_BRUSH_TYPE_PATTERN:
-        red_put_image(red->u.pattern.pat);
+        red_put_image(red_brush->u.pattern.pat);
         break;
     }
 }
 
 static void red_get_qmask_ptr(RedMemSlotInfo *slots, int group_id,
-                              SpiceQMask *red, QXLQMask *qxl, uint32_t flags)
+                              SpiceQMask *red_qmask, QXLQMask *qxl_qmask, uint32_t flags)
 {
-    red->flags  = qxl->flags;
-    red_get_point_ptr(&red->pos, &qxl->pos);
-    red->bitmap = red_get_image(slots, group_id, qxl->bitmap, flags, true);
+    red_qmask->flags  = qxl_qmask->flags;
+    red_get_point_ptr(&red_qmask->pos, &qxl_qmask->pos);
+    red_qmask->bitmap = red_get_image(slots, group_id, qxl_qmask->bitmap, flags, true);
 }
 
-static void red_put_qmask(SpiceQMask *red)
+static void red_put_qmask(SpiceQMask *red_qmask)
 {
-    red_put_image(red->bitmap);
+    red_put_image(red_qmask->bitmap);
 }
 
 static void red_get_fill_ptr(RedMemSlotInfo *slots, int group_id,
-                             SpiceFill *red, QXLFill *qxl, uint32_t flags)
+                             SpiceFill *red_fill, QXLFill *qxl_fill, uint32_t flags)
 {
-    red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush, flags);
-    red->rop_descriptor = qxl->rop_descriptor;
-    red_get_qmask_ptr(slots, group_id, &red->mask, &qxl->mask, flags);
+    red_get_brush_ptr(slots, group_id, &red_fill->brush, &qxl_fill->brush, flags);
+    red_fill->rop_descriptor = qxl_fill->rop_descriptor;
+    red_get_qmask_ptr(slots, group_id, &red_fill->mask, &qxl_fill->mask, flags);
 }
 
-static void red_put_fill(SpiceFill *red)
+static void red_put_fill(SpiceFill *red_fill)
 {
-    red_put_brush(&red->brush);
-    red_put_qmask(&red->mask);
+    red_put_brush(&red_fill->brush);
+    red_put_qmask(&red_fill->mask);
 }
 
 static void red_get_opaque_ptr(RedMemSlotInfo *slots, int group_id,
-                               SpiceOpaque *red, QXLOpaque *qxl, uint32_t flags)
+                               SpiceOpaque *red_opaque, QXLOpaque *qxl_opaque, uint32_t flags)
 {
-   red->src_bitmap     = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-   red_get_rect_ptr(&red->src_area, &qxl->src_area);
-   red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush, flags);
-   red->rop_descriptor = qxl->rop_descriptor;
-   red->scale_mode     = qxl->scale_mode;
-   red_get_qmask_ptr(slots, group_id, &red->mask, &qxl->mask, flags);
+   red_opaque->src_bitmap     = red_get_image(slots, group_id, qxl_opaque->src_bitmap, flags, false);
+   red_get_rect_ptr(&red_opaque->src_area, &qxl_opaque->src_area);
+   red_get_brush_ptr(slots, group_id, &red_opaque->brush, &qxl_opaque->brush, flags);
+   red_opaque->rop_descriptor = qxl_opaque->rop_descriptor;
+   red_opaque->scale_mode     = qxl_opaque->scale_mode;
+   red_get_qmask_ptr(slots, group_id, &red_opaque->mask, &qxl_opaque->mask, flags);
 }
 
-static void red_put_opaque(SpiceOpaque *red)
+static void red_put_opaque(SpiceOpaque *red_opaque)
 {
-    red_put_image(red->src_bitmap);
-    red_put_brush(&red->brush);
-    red_put_qmask(&red->mask);
+    red_put_image(red_opaque->src_bitmap);
+    red_put_brush(&red_opaque->brush);
+    red_put_qmask(&red_opaque->mask);
 }
 
 static bool red_get_copy_ptr(RedMemSlotInfo *slots, int group_id,
-                             SpiceCopy *red, QXLCopy *qxl, uint32_t flags)
+                             SpiceCopy *red_copy, QXLCopy *qxl_copy, uint32_t flags)
 {
-    red->src_bitmap      = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-    if (!red->src_bitmap) {
+    red_copy->src_bitmap = red_get_image(slots, group_id, qxl_copy->src_bitmap, flags, false);
+    if (!red_copy->src_bitmap) {
         return false;
     }
-    red_get_rect_ptr(&red->src_area, &qxl->src_area);
+    red_get_rect_ptr(&red_copy->src_area, &qxl_copy->src_area);
     /* The source area should not extend outside the source bitmap or have
      * swapped coordinates.
      */
-    if (red->src_area.left < 0 ||
-        red->src_area.left > red->src_area.right ||
-        red->src_area.top < 0 ||
-        red->src_area.top > red->src_area.bottom) {
+    if (red_copy->src_area.left < 0 ||
+        red_copy->src_area.left > red_copy->src_area.right ||
+        red_copy->src_area.top < 0 ||
+        red_copy->src_area.top > red_copy->src_area.bottom) {
         return false;
     }
-    if (red->src_bitmap->descriptor.type == SPICE_IMAGE_TYPE_BITMAP &&
-        (red->src_area.right > red->src_bitmap->u.bitmap.x ||
-         red->src_area.bottom > red->src_bitmap->u.bitmap.y)) {
+    if (red_copy->src_bitmap->descriptor.type == SPICE_IMAGE_TYPE_BITMAP &&
+        (red_copy->src_area.right > red_copy->src_bitmap->u.bitmap.x ||
+         red_copy->src_area.bottom > red_copy->src_bitmap->u.bitmap.y)) {
         return false;
     }
-    red->rop_descriptor  = qxl->rop_descriptor;
-    red->scale_mode      = qxl->scale_mode;
-    red_get_qmask_ptr(slots, group_id, &red->mask, &qxl->mask, flags);
+    red_copy->rop_descriptor  = qxl_copy->rop_descriptor;
+    red_copy->scale_mode      = qxl_copy->scale_mode;
+    red_get_qmask_ptr(slots, group_id, &red_copy->mask, &qxl_copy->mask, flags);
     return true;
 }
 
-static void red_put_copy(SpiceCopy *red)
+static void red_put_copy(SpiceCopy *red_copy)
 {
-    red_put_image(red->src_bitmap);
-    red_put_qmask(&red->mask);
+    red_put_image(red_copy->src_bitmap);
+    red_put_qmask(&red_copy->mask);
 }
 
 // these types are really the same thing
@@ -716,48 +716,48 @@ static void red_put_copy(SpiceCopy *red)
 #define red_put_blend red_put_copy
 
 static void red_get_transparent_ptr(RedMemSlotInfo *slots, int group_id,
-                                    SpiceTransparent *red, QXLTransparent *qxl,
+                                    SpiceTransparent *red_transparent, QXLTransparent *qxl_transparent,
                                     uint32_t flags)
 {
-    red->src_bitmap      = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-   red_get_rect_ptr(&red->src_area, &qxl->src_area);
-   red->src_color       = qxl->src_color;
-   red->true_color      = qxl->true_color;
+    red_transparent->src_bitmap      = red_get_image(slots, group_id, qxl_transparent->src_bitmap, flags, false);
+    red_get_rect_ptr(&red_transparent->src_area, &qxl_transparent->src_area);
+    red_transparent->src_color       = qxl_transparent->src_color;
+    red_transparent->true_color      = qxl_transparent->true_color;
 }
 
-static void red_put_transparent(SpiceTransparent *red)
+static void red_put_transparent(SpiceTransparent *red_transparent)
 {
-    red_put_image(red->src_bitmap);
+    red_put_image(red_transparent->src_bitmap);
 }
 
 static void red_get_alpha_blend_ptr(RedMemSlotInfo *slots, int group_id,
-                                    SpiceAlphaBlend *red, QXLAlphaBlend *qxl,
+                                    SpiceAlphaBlend *red_blend, QXLAlphaBlend *qxl_blend,
                                     uint32_t flags)
 {
-    red->alpha_flags = qxl->alpha_flags;
-    red->alpha       = qxl->alpha;
-    red->src_bitmap  = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-    red_get_rect_ptr(&red->src_area, &qxl->src_area);
+    red_blend->alpha_flags = qxl_blend->alpha_flags;
+    red_blend->alpha       = qxl_blend->alpha;
+    red_blend->src_bitmap  = red_get_image(slots, group_id, qxl_blend->src_bitmap, flags, false);
+    red_get_rect_ptr(&red_blend->src_area, &qxl_blend->src_area);
 }
 
 static void red_get_alpha_blend_ptr_compat(RedMemSlotInfo *slots, int group_id,
-                                           SpiceAlphaBlend *red, QXLCompatAlphaBlend *qxl,
+                                           SpiceAlphaBlend *red_blend, QXLCompatAlphaBlend *qxl_blend,
                                            uint32_t flags)
 {
-    red->alpha       = qxl->alpha;
-    red->src_bitmap  = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-    red_get_rect_ptr(&red->src_area, &qxl->src_area);
+    red_blend->alpha       = qxl_blend->alpha;
+    red_blend->src_bitmap  = red_get_image(slots, group_id, qxl_blend->src_bitmap, flags, false);
+    red_get_rect_ptr(&red_blend->src_area, &qxl_blend->src_area);
 }
 
-static void red_put_alpha_blend(SpiceAlphaBlend *red)
+static void red_put_alpha_blend(SpiceAlphaBlend *red_blend)
 {
-    red_put_image(red->src_bitmap);
+    red_put_image(red_blend->src_bitmap);
 }
 
 static bool get_transform(RedMemSlotInfo *slots,
                           int group_id,
                           QXLPHYSICAL qxl_transform,
-                          SpiceTransform *dst_transform)
+                          SpiceTransform *red_transform)
 {
     const uint32_t *t = NULL;
     int error;
@@ -765,103 +765,104 @@ static bool get_transform(RedMemSlotInfo *slots,
     if (qxl_transform == 0)
         return false;
 
-    t = (uint32_t *)memslot_get_virt(slots, qxl_transform, sizeof(*dst_transform), group_id, &error);
+    t = (uint32_t *)memslot_get_virt(slots, qxl_transform, sizeof(*red_transform), group_id, &error);
 
     if (!t || error)
         return false;
 
-    memcpy(dst_transform, t, sizeof(*dst_transform));
+    memcpy(red_transform, t, sizeof(*red_transform));
     return true;
 }
 
 static void red_get_composite_ptr(RedMemSlotInfo *slots, int group_id,
-                                  SpiceComposite *red, QXLComposite *qxl, uint32_t flags)
+                                  SpiceComposite *red_composite, QXLComposite *qxl_composite,
+                                  uint32_t flags)
 {
-    red->flags = qxl->flags;
+    red_composite->flags = qxl_composite->flags;
 
-    red->src_bitmap = red_get_image(slots, group_id, qxl->src, flags, false);
-    if (get_transform(slots, group_id, qxl->src_transform, &red->src_transform))
-        red->flags |= SPICE_COMPOSITE_HAS_SRC_TRANSFORM;
+    red_composite->src_bitmap = red_get_image(slots, group_id, qxl_composite->src, flags, false);
+    if (get_transform(slots, group_id, qxl_composite->src_transform, &red_composite->src_transform))
+        red_composite->flags |= SPICE_COMPOSITE_HAS_SRC_TRANSFORM;
 
-    if (qxl->mask) {
-        red->mask_bitmap = red_get_image(slots, group_id, qxl->mask, flags, false);
-        red->flags |= SPICE_COMPOSITE_HAS_MASK;
-        if (get_transform(slots, group_id, qxl->mask_transform, &red->mask_transform))
-            red->flags |= SPICE_COMPOSITE_HAS_MASK_TRANSFORM;
+    if (qxl_composite->mask) {
+        red_composite->mask_bitmap = red_get_image(slots, group_id, qxl_composite->mask, flags, false);
+        red_composite->flags |= SPICE_COMPOSITE_HAS_MASK;
+        if (get_transform(slots, group_id, qxl_composite->mask_transform, &red_composite->mask_transform))
+            red_composite->flags |= SPICE_COMPOSITE_HAS_MASK_TRANSFORM;
     } else {
-        red->mask_bitmap = NULL;
+        red_composite->mask_bitmap = NULL;
     }
-    red->src_origin.x = qxl->src_origin.x;
-    red->src_origin.y = qxl->src_origin.y;
-    red->mask_origin.x = qxl->mask_origin.x;
-    red->mask_origin.y = qxl->mask_origin.y;
+    red_composite->src_origin.x = qxl_composite->src_origin.x;
+    red_composite->src_origin.y = qxl_composite->src_origin.y;
+    red_composite->mask_origin.x = qxl_composite->mask_origin.x;
+    red_composite->mask_origin.y = qxl_composite->mask_origin.y;
 }
 
-static void red_put_composite(SpiceComposite *red)
+static void red_put_composite(SpiceComposite *red_composite)
 {
-    red_put_image(red->src_bitmap);
-    if (red->mask_bitmap)
-        red_put_image(red->mask_bitmap);
+    red_put_image(red_composite->src_bitmap);
+    if (red_composite->mask_bitmap)
+        red_put_image(red_composite->mask_bitmap);
 }
 
 static void red_get_rop3_ptr(RedMemSlotInfo *slots, int group_id,
-                             SpiceRop3 *red, QXLRop3 *qxl, uint32_t flags)
+                             SpiceRop3 *red_rop3, QXLRop3 *qxl_rop3, uint32_t flags)
 {
-   red->src_bitmap = red_get_image(slots, group_id, qxl->src_bitmap, flags, false);
-   red_get_rect_ptr(&red->src_area, &qxl->src_area);
-   red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush, flags);
-   red->rop3       = qxl->rop3;
-   red->scale_mode = qxl->scale_mode;
-   red_get_qmask_ptr(slots, group_id, &red->mask, &qxl->mask, flags);
+   red_rop3->src_bitmap = red_get_image(slots, group_id, qxl_rop3->src_bitmap, flags, false);
+   red_get_rect_ptr(&red_rop3->src_area, &qxl_rop3->src_area);
+   red_get_brush_ptr(slots, group_id, &red_rop3->brush, &qxl_rop3->brush, flags);
+   red_rop3->rop3       = qxl_rop3->rop3;
+   red_rop3->scale_mode = qxl_rop3->scale_mode;
+   red_get_qmask_ptr(slots, group_id, &red_rop3->mask, &qxl_rop3->mask, flags);
 }
 
-static void red_put_rop3(SpiceRop3 *red)
+static void red_put_rop3(SpiceRop3 *red_rop3)
 {
-    red_put_image(red->src_bitmap);
-    red_put_brush(&red->brush);
-    red_put_qmask(&red->mask);
+    red_put_image(red_rop3->src_bitmap);
+    red_put_brush(&red_rop3->brush);
+    red_put_qmask(&red_rop3->mask);
 }
 
 static bool red_get_stroke_ptr(RedMemSlotInfo *slots, int group_id,
-                               SpiceStroke *red, QXLStroke *qxl, uint32_t flags)
+                               SpiceStroke *red_stroke, QXLStroke *qxl_stroke, uint32_t flags)
 {
     int error;
 
-    red->path = red_get_path(slots, group_id, qxl->path);
-    if (!red->path) {
+    red_stroke->path = red_get_path(slots, group_id, qxl_stroke->path);
+    if (!red_stroke->path) {
         return false;
     }
-    red->attr.flags       = qxl->attr.flags;
-    if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
+    red_stroke->attr.flags       = qxl_stroke->attr.flags;
+    if (red_stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) {
         int style_nseg;
         uint8_t *buf;
 
-        style_nseg = qxl->attr.style_nseg;
-        red->attr.style = g_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
-        red->attr.style_nseg  = style_nseg;
-        spice_assert(qxl->attr.style);
-        buf = (uint8_t *)memslot_get_virt(slots, qxl->attr.style,
+        style_nseg = qxl_stroke->attr.style_nseg;
+        red_stroke->attr.style = g_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
+        red_stroke->attr.style_nseg  = style_nseg;
+        spice_assert(qxl_stroke->attr.style);
+        buf = (uint8_t *)memslot_get_virt(slots, qxl_stroke->attr.style,
                                           style_nseg * sizeof(QXLFIXED), group_id, &error);
         if (error) {
             return false;
         }
-        memcpy(red->attr.style, buf, style_nseg * sizeof(QXLFIXED));
+        memcpy(red_stroke->attr.style, buf, style_nseg * sizeof(QXLFIXED));
     } else {
-        red->attr.style_nseg  = 0;
-        red->attr.style       = NULL;
+        red_stroke->attr.style_nseg  = 0;
+        red_stroke->attr.style       = NULL;
     }
-    red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush, flags);
-    red->fore_mode        = qxl->fore_mode;
-    red->back_mode        = qxl->back_mode;
+    red_get_brush_ptr(slots, group_id, &red_stroke->brush, &qxl_stroke->brush, flags);
+    red_stroke->fore_mode        = qxl_stroke->fore_mode;
+    red_stroke->back_mode        = qxl_stroke->back_mode;
     return true;
 }
 
-static void red_put_stroke(SpiceStroke *red)
+static void red_put_stroke(SpiceStroke *red_stroke)
 {
-    red_put_brush(&red->brush);
-    g_free(red->path);
-    if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
-        g_free(red->attr.style);
+    red_put_brush(&red_stroke->brush);
+    g_free(red_stroke->path);
+    if (red_stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) {
+        g_free(red_stroke->attr.style);
     }
 }
 
@@ -869,9 +870,9 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
                                    QXLPHYSICAL addr)
 {
     RedDataChunk chunks;
-    QXLString *qxl;
+    QXLString *qxl_string;
     QXLRasterGlyph *start, *end;
-    SpiceString *red;
+    SpiceString *red_string;
     SpiceRasterGlyph *glyph;
     uint8_t *data;
     bool free_data;
@@ -882,22 +883,22 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
     int error;
     uint16_t qxl_flags, qxl_length;
 
-    qxl = (QXLString *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_string = (QXLString *)memslot_get_virt(slots, addr, sizeof(*qxl_string), group_id, &error);
     if (error) {
         return NULL;
     }
     chunk_size = red_get_data_chunks_ptr(slots, group_id,
                                          memslot_get_id(slots, addr),
-                                         &chunks, &qxl->chunk);
+                                         &chunks, &qxl_string->chunk);
     if (chunk_size == INVALID_SIZE) {
         return NULL;
     }
     data = red_linearize_chunk(&chunks, chunk_size, &free_data);
     red_put_data_chunks(&chunks);
 
-    qxl_size = qxl->data_size;
-    qxl_flags = qxl->flags;
-    qxl_length = qxl->length;
+    qxl_size = qxl_string->data_size;
+    qxl_flags = qxl_string->flags;
+    qxl_length = qxl_string->length;
     spice_assert(chunk_size == qxl_size);
 
     if (qxl_flags & SPICE_STRING_FLAGS_RASTER_A1) {
@@ -928,16 +929,16 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
     spice_assert(start <= end);
     spice_assert(glyphs == qxl_length);
 
-    red = g_malloc(red_size);
-    red->length = qxl_length;
-    red->flags = qxl_flags;
+    red_string = g_malloc(red_size);
+    red_string->length = qxl_length;
+    red_string->flags = qxl_flags;
 
     start = (QXLRasterGlyph*)data;
     end = (QXLRasterGlyph*)(data + chunk_size);
-    glyph = (SpiceRasterGlyph *)&red->glyphs[red->length];
-    for (i = 0; i < red->length; i++) {
+    glyph = (SpiceRasterGlyph *)&red_string->glyphs[red_string->length];
+    for (i = 0; i < red_string->length; i++) {
         spice_assert((QXLRasterGlyph*)(&start->data[0]) <= end);
-        red->glyphs[i] = glyph;
+        red_string->glyphs[i] = glyph;
         glyph->width = start->width;
         glyph->height = start->height;
         red_get_point_ptr(&glyph->render_pos, &start->render_pos);
@@ -955,36 +956,37 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
     if (free_data) {
         g_free(data);
     }
-    return red;
+    return red_string;
 }
 
 static void red_get_text_ptr(RedMemSlotInfo *slots, int group_id,
-                             SpiceText *red, QXLText *qxl, uint32_t flags)
+                             SpiceText *red_text, QXLText *qxl_text, uint32_t flags)
 {
-   red->str = red_get_string(slots, group_id, qxl->str);
-   red_get_rect_ptr(&red->back_area, &qxl->back_area);
-   red_get_brush_ptr(slots, group_id, &red->fore_brush, &qxl->fore_brush, flags);
-   red_get_brush_ptr(slots, group_id, &red->back_brush, &qxl->back_brush, flags);
-   red->fore_mode  = qxl->fore_mode;
-   red->back_mode  = qxl->back_mode;
+   red_text->str = red_get_string(slots, group_id, qxl_text->str);
+   red_get_rect_ptr(&red_text->back_area, &qxl_text->back_area);
+   red_get_brush_ptr(slots, group_id, &red_text->fore_brush, &qxl_text->fore_brush, flags);
+   red_get_brush_ptr(slots, group_id, &red_text->back_brush, &qxl_text->back_brush, flags);
+   red_text->fore_mode  = qxl_text->fore_mode;
+   red_text->back_mode  = qxl_text->back_mode;
 }
 
-static void red_put_text_ptr(SpiceText *red)
+static void red_put_text_ptr(SpiceText *red_text)
 {
-    g_free(red->str);
-    red_put_brush(&red->fore_brush);
-    red_put_brush(&red->back_brush);
+    g_free(red_text->str);
+    red_put_brush(&red_text->fore_brush);
+    red_put_brush(&red_text->back_brush);
 }
 
 static void red_get_whiteness_ptr(RedMemSlotInfo *slots, int group_id,
-                                  SpiceWhiteness *red, QXLWhiteness *qxl, uint32_t flags)
+                                  SpiceWhiteness *red_whiteness, QXLWhiteness *qxl_whiteness,
+                                  uint32_t flags)
 {
-    red_get_qmask_ptr(slots, group_id, &red->mask, &qxl->mask, flags);
+    red_get_qmask_ptr(slots, group_id, &red_whiteness->mask, &qxl_whiteness->mask, flags);
 }
 
-static void red_put_whiteness(SpiceWhiteness *red)
+static void red_put_whiteness(SpiceWhiteness *red_whiteness)
 {
-    red_put_qmask(&red->mask);
+    red_put_qmask(&red_whiteness->mask);
 }
 
 #define red_get_invers_ptr red_get_whiteness_ptr
@@ -993,286 +995,285 @@ static void red_put_whiteness(SpiceWhiteness *red)
 #define red_put_blackness red_put_whiteness
 
 static void red_get_clip_ptr(RedMemSlotInfo *slots, int group_id,
-                             SpiceClip *red, QXLClip *qxl)
+                             SpiceClip *red_clip, QXLClip *qxl_clip)
 {
-    red->type = qxl->type;
-    switch (red->type) {
+    red_clip->type = qxl_clip->type;
+    switch (red_clip->type) {
     case SPICE_CLIP_TYPE_RECTS:
-        red->rects = red_get_clip_rects(slots, group_id, qxl->data);
+        red_clip->rects = red_get_clip_rects(slots, group_id, qxl_clip->data);
         break;
     }
 }
 
-static void red_put_clip(SpiceClip *red)
+static void red_put_clip(SpiceClip *red_clip)
 {
-    switch (red->type) {
+    switch (red_clip->type) {
     case SPICE_CLIP_TYPE_RECTS:
-        g_free(red->rects);
+        g_free(red_clip->rects);
         break;
     }
 }
 
 static bool red_get_native_drawable(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
-                                    RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
+                                    RedDrawable *red_drawable, QXLPHYSICAL addr, uint32_t flags)
 {
-    QXLDrawable *qxl;
+    QXLDrawable *qxl_drawable;
     int i;
     int error = 0;
 
-    qxl = (QXLDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_drawable = (QXLDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl_drawable), group_id, &error);
     if (error) {
         return false;
     }
-    red->qxl = qxl_instance;
-    red->release_info_ext.info     = &qxl->release_info;
-    red->release_info_ext.group_id = group_id;
+    red_drawable->qxl = qxl_instance;
+    red_drawable->release_info_ext.info     = &qxl_drawable->release_info;
+    red_drawable->release_info_ext.group_id = group_id;
 
-    red_get_rect_ptr(&red->bbox, &qxl->bbox);
-    red_get_clip_ptr(slots, group_id, &red->clip, &qxl->clip);
-    red->effect           = qxl->effect;
-    red->mm_time          = qxl->mm_time;
-    red->self_bitmap      = qxl->self_bitmap;
-    red_get_rect_ptr(&red->self_bitmap_area, &qxl->self_bitmap_area);
-    red->surface_id       = qxl->surface_id;
+    red_get_rect_ptr(&red_drawable->bbox, &qxl_drawable->bbox);
+    red_get_clip_ptr(slots, group_id, &red_drawable->clip, &qxl_drawable->clip);
+    red_drawable->effect           = qxl_drawable->effect;
+    red_drawable->mm_time          = qxl_drawable->mm_time;
+    red_drawable->self_bitmap      = qxl_drawable->self_bitmap;
+    red_get_rect_ptr(&red_drawable->self_bitmap_area, &qxl_drawable->self_bitmap_area);
+    red_drawable->surface_id       = qxl_drawable->surface_id;
 
     for (i = 0; i < 3; i++) {
-        red->surface_deps[i] = qxl->surfaces_dest[i];
-        red_get_rect_ptr(&red->surfaces_rects[i], &qxl->surfaces_rects[i]);
+        red_drawable->surface_deps[i] = qxl_drawable->surfaces_dest[i];
+        red_get_rect_ptr(&red_drawable->surfaces_rects[i], &qxl_drawable->surfaces_rects[i]);
     }
 
-    red->type = qxl->type;
-    switch (red->type) {
+    red_drawable->type = qxl_drawable->type;
+    switch (red_drawable->type) {
     case QXL_DRAW_ALPHA_BLEND:
         red_get_alpha_blend_ptr(slots, group_id,
-                                &red->u.alpha_blend, &qxl->u.alpha_blend, flags);
+                                &red_drawable->u.alpha_blend, &qxl_drawable->u.alpha_blend, flags);
         break;
     case QXL_DRAW_BLACKNESS:
         red_get_blackness_ptr(slots, group_id,
-                              &red->u.blackness, &qxl->u.blackness, flags);
+                              &red_drawable->u.blackness, &qxl_drawable->u.blackness, flags);
         break;
     case QXL_DRAW_BLEND:
-        return red_get_blend_ptr(slots, group_id, &red->u.blend, &qxl->u.blend, flags);
+        return red_get_blend_ptr(slots, group_id, &red_drawable->u.blend, &qxl_drawable->u.blend, flags);
     case QXL_DRAW_COPY:
-        return red_get_copy_ptr(slots, group_id, &red->u.copy, &qxl->u.copy, flags);
+        return red_get_copy_ptr(slots, group_id, &red_drawable->u.copy, &qxl_drawable->u.copy, flags);
     case QXL_COPY_BITS:
-        red_get_point_ptr(&red->u.copy_bits.src_pos, &qxl->u.copy_bits.src_pos);
+        red_get_point_ptr(&red_drawable->u.copy_bits.src_pos, &qxl_drawable->u.copy_bits.src_pos);
         break;
     case QXL_DRAW_FILL:
-        red_get_fill_ptr(slots, group_id, &red->u.fill, &qxl->u.fill, flags);
+        red_get_fill_ptr(slots, group_id, &red_drawable->u.fill, &qxl_drawable->u.fill, flags);
         break;
     case QXL_DRAW_OPAQUE:
-        red_get_opaque_ptr(slots, group_id, &red->u.opaque, &qxl->u.opaque, flags);
+        red_get_opaque_ptr(slots, group_id, &red_drawable->u.opaque, &qxl_drawable->u.opaque, flags);
         break;
     case QXL_DRAW_INVERS:
-        red_get_invers_ptr(slots, group_id, &red->u.invers, &qxl->u.invers, flags);
+        red_get_invers_ptr(slots, group_id, &red_drawable->u.invers, &qxl_drawable->u.invers, flags);
         break;
     case QXL_DRAW_NOP:
         break;
     case QXL_DRAW_ROP3:
-        red_get_rop3_ptr(slots, group_id, &red->u.rop3, &qxl->u.rop3, flags);
+        red_get_rop3_ptr(slots, group_id, &red_drawable->u.rop3, &qxl_drawable->u.rop3, flags);
         break;
     case QXL_DRAW_COMPOSITE:
-        red_get_composite_ptr(slots, group_id, &red->u.composite, &qxl->u.composite, flags);
+        red_get_composite_ptr(slots, group_id, &red_drawable->u.composite, &qxl_drawable->u.composite, flags);
         break;
     case QXL_DRAW_STROKE:
-        return red_get_stroke_ptr(slots, group_id, &red->u.stroke, &qxl->u.stroke, flags);
+        return red_get_stroke_ptr(slots, group_id, &red_drawable->u.stroke, &qxl_drawable->u.stroke, flags);
     case QXL_DRAW_TEXT:
-        red_get_text_ptr(slots, group_id, &red->u.text, &qxl->u.text, flags);
+        red_get_text_ptr(slots, group_id, &red_drawable->u.text, &qxl_drawable->u.text, flags);
         break;
     case QXL_DRAW_TRANSPARENT:
         red_get_transparent_ptr(slots, group_id,
-                                &red->u.transparent, &qxl->u.transparent, flags);
+                                &red_drawable->u.transparent, &qxl_drawable->u.transparent, flags);
         break;
     case QXL_DRAW_WHITENESS:
         red_get_whiteness_ptr(slots, group_id,
-                              &red->u.whiteness, &qxl->u.whiteness, flags);
+                              &red_drawable->u.whiteness, &qxl_drawable->u.whiteness, flags);
         break;
     default:
-        spice_warning("unknown type %d", red->type);
+        spice_warning("unknown type %d", red_drawable->type);
         return false;
     };
     return true;
 }
 
 static bool red_get_compat_drawable(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
-                                    RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
+                                    RedDrawable *red_drawable, QXLPHYSICAL addr, uint32_t flags)
 {
-    QXLCompatDrawable *qxl;
+    QXLCompatDrawable *qxl_drawable;
     int error;
 
-    qxl = (QXLCompatDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_drawable = (QXLCompatDrawable *)memslot_get_virt(slots, addr, sizeof(*qxl_drawable), group_id, &error);
     if (error) {
         return false;
     }
-    red->qxl = qxl_instance;
-    red->release_info_ext.info     = &qxl->release_info;
-    red->release_info_ext.group_id = group_id;
+    red_drawable->qxl = qxl_instance;
+    red_drawable->release_info_ext.info     = &qxl_drawable->release_info;
+    red_drawable->release_info_ext.group_id = group_id;
 
-    red_get_rect_ptr(&red->bbox, &qxl->bbox);
-    red_get_clip_ptr(slots, group_id, &red->clip, &qxl->clip);
-    red->effect           = qxl->effect;
-    red->mm_time          = qxl->mm_time;
+    red_get_rect_ptr(&red_drawable->bbox, &qxl_drawable->bbox);
+    red_get_clip_ptr(slots, group_id, &red_drawable->clip, &qxl_drawable->clip);
+    red_drawable->effect           = qxl_drawable->effect;
+    red_drawable->mm_time          = qxl_drawable->mm_time;
 
-    red->self_bitmap = (qxl->bitmap_offset != 0);
-    red_get_rect_ptr(&red->self_bitmap_area, &qxl->bitmap_area);
+    red_drawable->self_bitmap = (qxl_drawable->bitmap_offset != 0);
+    red_get_rect_ptr(&red_drawable->self_bitmap_area, &qxl_drawable->bitmap_area);
 
-    red->surface_deps[0] = -1;
-    red->surface_deps[1] = -1;
-    red->surface_deps[2] = -1;
+    red_drawable->surface_deps[0] = -1;
+    red_drawable->surface_deps[1] = -1;
+    red_drawable->surface_deps[2] = -1;
 
-    red->type = qxl->type;
-    switch (red->type) {
+    red_drawable->type = qxl_drawable->type;
+    switch (red_drawable->type) {
     case QXL_DRAW_ALPHA_BLEND:
         red_get_alpha_blend_ptr_compat(slots, group_id,
-                                       &red->u.alpha_blend, &qxl->u.alpha_blend, flags);
+                                       &red_drawable->u.alpha_blend, &qxl_drawable->u.alpha_blend, flags);
         break;
     case QXL_DRAW_BLACKNESS:
         red_get_blackness_ptr(slots, group_id,
-                              &red->u.blackness, &qxl->u.blackness, flags);
+                              &red_drawable->u.blackness, &qxl_drawable->u.blackness, flags);
         break;
     case QXL_DRAW_BLEND:
-        return red_get_blend_ptr(slots, group_id, &red->u.blend, &qxl->u.blend, flags);
+        return red_get_blend_ptr(slots, group_id, &red_drawable->u.blend, &qxl_drawable->u.blend, flags);
     case QXL_DRAW_COPY:
-        return red_get_copy_ptr(slots, group_id, &red->u.copy, &qxl->u.copy, flags);
+        return red_get_copy_ptr(slots, group_id, &red_drawable->u.copy, &qxl_drawable->u.copy, flags);
     case QXL_COPY_BITS:
-        red_get_point_ptr(&red->u.copy_bits.src_pos, &qxl->u.copy_bits.src_pos);
-        red->surface_deps[0] = 0;
-        red->surfaces_rects[0].left   = red->u.copy_bits.src_pos.x;
-        red->surfaces_rects[0].right  = red->u.copy_bits.src_pos.x +
-            (red->bbox.right - red->bbox.left);
-        red->surfaces_rects[0].top    = red->u.copy_bits.src_pos.y;
-        red->surfaces_rects[0].bottom = red->u.copy_bits.src_pos.y +
-            (red->bbox.bottom - red->bbox.top);
+        red_get_point_ptr(&red_drawable->u.copy_bits.src_pos, &qxl_drawable->u.copy_bits.src_pos);
+        red_drawable->surface_deps[0] = 0;
+        red_drawable->surfaces_rects[0].left   = red_drawable->u.copy_bits.src_pos.x;
+        red_drawable->surfaces_rects[0].right  = red_drawable->u.copy_bits.src_pos.x +
+            (red_drawable->bbox.right - red_drawable->bbox.left);
+        red_drawable->surfaces_rects[0].top    = red_drawable->u.copy_bits.src_pos.y;
+        red_drawable->surfaces_rects[0].bottom = red_drawable->u.copy_bits.src_pos.y +
+            (red_drawable->bbox.bottom - red_drawable->bbox.top);
         break;
     case QXL_DRAW_FILL:
-        red_get_fill_ptr(slots, group_id, &red->u.fill, &qxl->u.fill, flags);
+        red_get_fill_ptr(slots, group_id, &red_drawable->u.fill, &qxl_drawable->u.fill, flags);
         break;
     case QXL_DRAW_OPAQUE:
-        red_get_opaque_ptr(slots, group_id, &red->u.opaque, &qxl->u.opaque, flags);
+        red_get_opaque_ptr(slots, group_id, &red_drawable->u.opaque, &qxl_drawable->u.opaque, flags);
         break;
     case QXL_DRAW_INVERS:
-        red_get_invers_ptr(slots, group_id, &red->u.invers, &qxl->u.invers, flags);
+        red_get_invers_ptr(slots, group_id, &red_drawable->u.invers, &qxl_drawable->u.invers, flags);
         break;
     case QXL_DRAW_NOP:
         break;
     case QXL_DRAW_ROP3:
-        red_get_rop3_ptr(slots, group_id, &red->u.rop3, &qxl->u.rop3, flags);
+        red_get_rop3_ptr(slots, group_id, &red_drawable->u.rop3, &qxl_drawable->u.rop3, flags);
         break;
     case QXL_DRAW_STROKE:
-        return red_get_stroke_ptr(slots, group_id, &red->u.stroke, &qxl->u.stroke, flags);
+        return red_get_stroke_ptr(slots, group_id, &red_drawable->u.stroke, &qxl_drawable->u.stroke, flags);
     case QXL_DRAW_TEXT:
-        red_get_text_ptr(slots, group_id, &red->u.text, &qxl->u.text, flags);
+        red_get_text_ptr(slots, group_id, &red_drawable->u.text, &qxl_drawable->u.text, flags);
         break;
     case QXL_DRAW_TRANSPARENT:
         red_get_transparent_ptr(slots, group_id,
-                                &red->u.transparent, &qxl->u.transparent, flags);
+                                &red_drawable->u.transparent, &qxl_drawable->u.transparent, flags);
         break;
     case QXL_DRAW_WHITENESS:
         red_get_whiteness_ptr(slots, group_id,
-                              &red->u.whiteness, &qxl->u.whiteness, flags);
+                              &red_drawable->u.whiteness, &qxl_drawable->u.whiteness, flags);
         break;
     default:
-        spice_warning("unknown type %d", red->type);
+        spice_warning("unknown type %d", red_drawable->type);
         return false;
     };
     return true;
 }
 
-static bool red_get_drawable(QXLInstance *qxl, RedMemSlotInfo *slots, int group_id,
-                             RedDrawable *red, QXLPHYSICAL addr, uint32_t flags)
+static bool red_get_drawable(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
+                             RedDrawable *red_drawable, QXLPHYSICAL addr, uint32_t flags)
 {
     bool ret;
 
-    red->qxl = qxl;
+    red_drawable->qxl = qxl_instance;
     if (flags & QXL_COMMAND_FLAG_COMPAT) {
-        ret = red_get_compat_drawable(qxl, slots, group_id, red, addr, flags);
+        ret = red_get_compat_drawable(qxl_instance, slots, group_id, red_drawable, addr, flags);
     } else {
-        ret = red_get_native_drawable(qxl, slots, group_id, red, addr, flags);
+        ret = red_get_native_drawable(qxl_instance, slots, group_id, red_drawable, addr, flags);
     }
     return ret;
 }
 
-static void red_put_drawable(RedDrawable *red)
+static void red_put_drawable(RedDrawable *red_drawable)
 {
-    red_put_clip(&red->clip);
-    if (red->self_bitmap_image) {
-        red_put_image(red->self_bitmap_image);
+    red_put_clip(&red_drawable->clip);
+    if (red_drawable->self_bitmap_image) {
+        red_put_image(red_drawable->self_bitmap_image);
     }
-    switch (red->type) {
+    switch (red_drawable->type) {
     case QXL_DRAW_ALPHA_BLEND:
-        red_put_alpha_blend(&red->u.alpha_blend);
+        red_put_alpha_blend(&red_drawable->u.alpha_blend);
         break;
     case QXL_DRAW_BLACKNESS:
-        red_put_blackness(&red->u.blackness);
+        red_put_blackness(&red_drawable->u.blackness);
         break;
     case QXL_DRAW_BLEND:
-        red_put_blend(&red->u.blend);
+        red_put_blend(&red_drawable->u.blend);
         break;
     case QXL_DRAW_COPY:
-        red_put_copy(&red->u.copy);
+        red_put_copy(&red_drawable->u.copy);
         break;
     case QXL_DRAW_FILL:
-        red_put_fill(&red->u.fill);
+        red_put_fill(&red_drawable->u.fill);
         break;
     case QXL_DRAW_OPAQUE:
-        red_put_opaque(&red->u.opaque);
+        red_put_opaque(&red_drawable->u.opaque);
         break;
     case QXL_DRAW_INVERS:
-        red_put_invers(&red->u.invers);
+        red_put_invers(&red_drawable->u.invers);
         break;
     case QXL_DRAW_ROP3:
-        red_put_rop3(&red->u.rop3);
+        red_put_rop3(&red_drawable->u.rop3);
         break;
     case QXL_DRAW_COMPOSITE:
-        red_put_composite(&red->u.composite);
+        red_put_composite(&red_drawable->u.composite);
         break;
     case QXL_DRAW_STROKE:
-        red_put_stroke(&red->u.stroke);
+        red_put_stroke(&red_drawable->u.stroke);
         break;
     case QXL_DRAW_TEXT:
-        red_put_text_ptr(&red->u.text);
+        red_put_text_ptr(&red_drawable->u.text);
         break;
     case QXL_DRAW_TRANSPARENT:
-        red_put_transparent(&red->u.transparent);
+        red_put_transparent(&red_drawable->u.transparent);
         break;
     case QXL_DRAW_WHITENESS:
-        red_put_whiteness(&red->u.whiteness);
+        red_put_whiteness(&red_drawable->u.whiteness);
         break;
     }
 }
 
-bool red_get_update_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots,
-                        int group_id, RedUpdateCmd *red,
-                        QXLPHYSICAL addr)
+bool red_get_update_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
+                        RedUpdateCmd *red_cmd, QXLPHYSICAL addr)
 {
-    QXLUpdateCmd *qxl;
+    QXLUpdateCmd *qxl_cmd;
     int error;
 
-    qxl = (QXLUpdateCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_cmd = (QXLUpdateCmd *)memslot_get_virt(slots, addr, sizeof(*qxl_cmd), group_id, &error);
     if (error) {
         return false;
     }
-    red->qxl = qxl_instance;
-    red->release_info_ext.info     = &qxl->release_info;
-    red->release_info_ext.group_id = group_id;
+    red_cmd->qxl = qxl_instance;
+    red_cmd->release_info_ext.info     = &qxl_cmd->release_info;
+    red_cmd->release_info_ext.group_id = group_id;
 
-    red_get_rect_ptr(&red->area, &qxl->area);
-    red->update_id  = qxl->update_id;
-    red->surface_id = qxl->surface_id;
+    red_get_rect_ptr(&red_cmd->area, &qxl_cmd->area);
+    red_cmd->update_id  = qxl_cmd->update_id;
+    red_cmd->surface_id = qxl_cmd->surface_id;
     return true;
 }
 
-void red_put_update_cmd(RedUpdateCmd *red)
+void red_put_update_cmd(RedUpdateCmd *red_cmd)
 {
-    if (red->qxl != NULL) {
-        red_qxl_release_resource(red->qxl, red->release_info_ext);
+    if (red_cmd->qxl != NULL) {
+        red_qxl_release_resource(red_cmd->qxl, red_cmd->release_info_ext);
     }
 }
 
 bool red_get_message(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
-                     RedMessage *red, QXLPHYSICAL addr)
+                     RedMessage *red_message, QXLPHYSICAL addr)
 {
-    QXLMessage *qxl;
+    QXLMessage *qxl_message;
     int error;
     int memslot_id;
     unsigned long len;
@@ -1280,33 +1281,33 @@ bool red_get_message(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group
 
     /*
      * security alert:
-     *   qxl->data[0] size isn't specified anywhere -> can't verify
+     *   qxl_message->data[0] size isn't specified anywhere -> can't verify
      *   luckily this is for debug logging only,
      *   so we can just ignore it by default.
      */
-    qxl = (QXLMessage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_message = (QXLMessage *)memslot_get_virt(slots, addr, sizeof(*qxl_message), group_id, &error);
     if (error) {
         return false;
     }
-    red->qxl = qxl_instance;
-    red->release_info_ext.info      = &qxl->release_info;
-    red->release_info_ext.group_id  = group_id;
-    red->data                       = qxl->data;
-    memslot_id = memslot_get_id(slots, addr+sizeof(*qxl));
-    len = memslot_max_size_virt(slots, ((intptr_t) qxl)+sizeof(*qxl), memslot_id, group_id);
+    red_message->qxl = qxl_instance;
+    red_message->release_info_ext.info      = &qxl_message->release_info;
+    red_message->release_info_ext.group_id  = group_id;
+    red_message->data                       = qxl_message->data;
+    memslot_id = memslot_get_id(slots, addr+sizeof(*qxl_message));
+    len = memslot_max_size_virt(slots, ((intptr_t) qxl_message)+sizeof(*qxl_message), memslot_id, group_id);
     len = MIN(len, 100000);
-    end = (uint8_t *)memchr(qxl->data, 0, len);
+    end = (uint8_t *)memchr(qxl_message->data, 0, len);
     if (end == NULL) {
         return false;
     }
-    red->len = end - qxl->data;
+    red_message->len = end - qxl_message->data;
     return true;
 }
 
-void red_put_message(RedMessage *red)
+void red_put_message(RedMessage *red_message)
 {
-   if (red->qxl != NULL)
-       red_qxl_release_resource(red->qxl, red->release_info_ext);
+   if (red_message->qxl != NULL)
+       red_qxl_release_resource(red_message->qxl, red_message->release_info_ext);
 }
 
 static unsigned int surface_format_to_bpp(uint32_t format)
@@ -1356,39 +1357,39 @@ bool red_validate_surface(uint32_t width, uint32_t height,
 }
 
 bool red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
-                         RedSurfaceCmd *red, QXLPHYSICAL addr)
+                         RedSurfaceCmd *red_cmd, QXLPHYSICAL addr)
 {
-    QXLSurfaceCmd *qxl;
+    QXLSurfaceCmd *qxl_cmd;
     uint64_t size;
     int error;
 
-    qxl = (QXLSurfaceCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
-                                            &error);
+    qxl_cmd = (QXLSurfaceCmd *)memslot_get_virt(slots, addr, sizeof(*qxl_cmd), group_id,
+                                                &error);
     if (error) {
         return false;
     }
-    red->release_info_ext.info      = &qxl->release_info;
-    red->release_info_ext.group_id  = group_id;
+    red_cmd->release_info_ext.info      = &qxl_cmd->release_info;
+    red_cmd->release_info_ext.group_id  = group_id;
 
-    red->surface_id = qxl->surface_id;
-    red->type       = qxl->type;
-    red->flags      = qxl->flags;
+    red_cmd->surface_id = qxl_cmd->surface_id;
+    red_cmd->type       = qxl_cmd->type;
+    red_cmd->flags      = qxl_cmd->flags;
 
-    switch (red->type) {
+    switch (red_cmd->type) {
     case QXL_SURFACE_CMD_CREATE:
-        red->u.surface_create.format = qxl->u.surface_create.format;
-        red->u.surface_create.width  = qxl->u.surface_create.width;
-        red->u.surface_create.height = qxl->u.surface_create.height;
-        red->u.surface_create.stride = qxl->u.surface_create.stride;
+        red_cmd->u.surface_create.format = qxl_cmd->u.surface_create.format;
+        red_cmd->u.surface_create.width  = qxl_cmd->u.surface_create.width;
+        red_cmd->u.surface_create.height = qxl_cmd->u.surface_create.height;
+        red_cmd->u.surface_create.stride = qxl_cmd->u.surface_create.stride;
 
-        if (!red_validate_surface(red->u.surface_create.width, red->u.surface_create.height,
-                                  red->u.surface_create.stride, red->u.surface_create.format)) {
+        if (!red_validate_surface(red_cmd->u.surface_create.width, red_cmd->u.surface_create.height,
+                                  red_cmd->u.surface_create.stride, red_cmd->u.surface_create.format)) {
             return false;
         }
 
-        size = red->u.surface_create.height * abs(red->u.surface_create.stride);
-        red->u.surface_create.data =
-            (uint8_t*)memslot_get_virt(slots, qxl->u.surface_create.data, size, group_id, &error);
+        size = red_cmd->u.surface_create.height * abs(red_cmd->u.surface_create.stride);
+        red_cmd->u.surface_create.data =
+            (uint8_t*)memslot_get_virt(slots, qxl_cmd->u.surface_create.data, size, group_id, &error);
         if (error) {
             return false;
         }
@@ -1397,97 +1398,96 @@ bool red_get_surface_cmd(RedMemSlotInfo *slots, int group_id,
     return true;
 }
 
-void red_put_surface_cmd(RedSurfaceCmd *red)
+void red_put_surface_cmd(RedSurfaceCmd *red_cmd)
 {
     /* nothing yet */
 }
 
 static bool red_get_cursor(RedMemSlotInfo *slots, int group_id,
-                           SpiceCursor *red, QXLPHYSICAL addr)
+                           SpiceCursor *red_cursor, QXLPHYSICAL addr)
 {
-    QXLCursor *qxl;
+    QXLCursor *qxl_cursor;
     RedDataChunk chunks;
     size_t size;
     uint8_t *data;
     bool free_data;
     int error;
 
-    qxl = (QXLCursor *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_cursor = (QXLCursor *)memslot_get_virt(slots, addr, sizeof(*qxl_cursor), group_id, &error);
     if (error) {
         return false;
     }
 
-    red->header.unique     = qxl->header.unique;
-    red->header.type       = qxl->header.type;
-    red->header.width      = qxl->header.width;
-    red->header.height     = qxl->header.height;
-    red->header.hot_spot_x = qxl->header.hot_spot_x;
-    red->header.hot_spot_y = qxl->header.hot_spot_y;
+    red_cursor->header.unique     = qxl_cursor->header.unique;
+    red_cursor->header.type       = qxl_cursor->header.type;
+    red_cursor->header.width      = qxl_cursor->header.width;
+    red_cursor->header.height     = qxl_cursor->header.height;
+    red_cursor->header.hot_spot_x = qxl_cursor->header.hot_spot_x;
+    red_cursor->header.hot_spot_y = qxl_cursor->header.hot_spot_y;
 
-    red->flags = 0;
-    red->data_size = qxl->data_size;
+    red_cursor->flags = 0;
+    red_cursor->data_size = qxl_cursor->data_size;
     size = red_get_data_chunks_ptr(slots, group_id,
                                    memslot_get_id(slots, addr),
-                                   &chunks, &qxl->chunk);
+                                   &chunks, &qxl_cursor->chunk);
     if (size == INVALID_SIZE) {
         return false;
     }
-    red->data_size = MIN(red->data_size, size);
+    red_cursor->data_size = MIN(red_cursor->data_size, size);
     data = red_linearize_chunk(&chunks, size, &free_data);
     red_put_data_chunks(&chunks);
     if (free_data) {
-        red->data = data;
+        red_cursor->data = data;
     } else {
-        red->data = g_memdup(data, size);
+        red_cursor->data = g_memdup(data, size);
     }
     return true;
 }
 
-static void red_put_cursor(SpiceCursor *red)
+static void red_put_cursor(SpiceCursor *red_cmd)
 {
-    g_free(red->data);
+    g_free(red_cmd->data);
 }
 
-static bool red_get_cursor_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots,
-                               int group_id, RedCursorCmd *red,
-                               QXLPHYSICAL addr)
+static bool red_get_cursor_cmd(QXLInstance *qxl_instance, RedMemSlotInfo *slots, int group_id,
+                               RedCursorCmd *red_cmd, QXLPHYSICAL addr)
 {
-    QXLCursorCmd *qxl;
+    QXLCursorCmd *qxl_cmd;
     int error;
 
-    qxl = (QXLCursorCmd *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id, &error);
+    qxl_cmd = (QXLCursorCmd *)memslot_get_virt(slots, addr, sizeof(*qxl_cmd), group_id, &error);
     if (error) {
         return false;
     }
-    red->qxl = qxl_instance;
-    red->release_info_ext.info      = &qxl->release_info;
-    red->release_info_ext.group_id  = group_id;
+    red_cmd->qxl = qxl_instance;
+    red_cmd->release_info_ext.info      = &qxl_cmd->release_info;
+    red_cmd->release_info_ext.group_id  = group_id;
 
-    red->type = qxl->type;
-    switch (red->type) {
+    red_cmd->type = qxl_cmd->type;
+    switch (red_cmd->type) {
     case QXL_CURSOR_SET:
-        red_get_point16_ptr(&red->u.set.position, &qxl->u.set.position);
-        red->u.set.visible  = qxl->u.set.visible;
-        return red_get_cursor(slots, group_id,  &red->u.set.shape, qxl->u.set.shape);
+        red_get_point16_ptr(&red_cmd->u.set.position, &qxl_cmd->u.set.position);
+        red_cmd->u.set.visible  = qxl_cmd->u.set.visible;
+        return red_get_cursor(slots, group_id,  &red_cmd->u.set.shape, qxl_cmd->u.set.shape);
     case QXL_CURSOR_MOVE:
-        red_get_point16_ptr(&red->u.position, &qxl->u.position);
+        red_get_point16_ptr(&red_cmd->u.position, &qxl_cmd->u.position);
         break;
     case QXL_CURSOR_TRAIL:
-        red->u.trail.length    = qxl->u.trail.length;
-        red->u.trail.frequency = qxl->u.trail.frequency;
+        red_cmd->u.trail.length    = qxl_cmd->u.trail.length;
+        red_cmd->u.trail.frequency = qxl_cmd->u.trail.frequency;
         break;
     }
 
     return true;
 }
 
-RedCursorCmd *red_cursor_cmd_new(QXLInstance *qxl, RedMemSlotInfo *slots,
+RedCursorCmd *red_cursor_cmd_new(QXLInstance *qxl_instance, RedMemSlotInfo *slots,
                                  int group_id, QXLPHYSICAL addr)
 {
     RedCursorCmd *cmd;
 
     cmd = g_new0(RedCursorCmd, 1);
-    if (!red_get_cursor_cmd(qxl, slots, group_id, cmd, addr)) {
+    if (!red_get_cursor_cmd(qxl_instance, slots, group_id, cmd, addr)) {
         g_free(cmd);
         return NULL;
     }
@@ -1495,17 +1495,17 @@ RedCursorCmd *red_cursor_cmd_new(QXLInstance *qxl, RedMemSlotInfo *slots,
     return cmd;
 }
 
-void red_cursor_cmd_free(RedCursorCmd *red)
+void red_cursor_cmd_free(RedCursorCmd *red_cmd)
 {
-    switch (red->type) {
+    switch (red_cmd->type) {
     case QXL_CURSOR_SET:
-        red_put_cursor(&red->u.set.shape);
+        red_put_cursor(&red_cmd->u.set.shape);
         break;
     }
-    if (red->qxl) {
-        red_qxl_release_resource(red->qxl, red->release_info_ext);
+    if (red_cmd->qxl) {
+        red_qxl_release_resource(red_cmd->qxl, red_cmd->release_info_ext);
     }
-    g_free(red);
+    g_free(red_cmd);
 }
 
 void red_drawable_unref(RedDrawable *red_drawable)
-- 
2.14.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]