[Spice-devel] [PATCH spice-server v2] Use SPICE_VERIFY macro for RHEL6 compatibility

Frediano Ziglio fziglio at redhat.com
Mon Nov 14 16:56:13 UTC 2016


The verify macro used currently has some problem
as it raise a warning in RHEL6.
Use new SPICE_VERIFY macro defined in spice-common
to avoid this issue.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/cache-item.tmpl.c   | 2 +-
 server/dcc.c               | 2 +-
 server/display-channel.c   | 4 ++--
 server/gstreamer-encoder.c | 2 +-
 server/image-cache.c       | 6 +++---
 server/pixmap-cache.c      | 2 +-
 server/tree.c              | 4 ++--
 spice-common               | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

Changes since v1:
- moved macro definition to spice-common.

diff --git a/server/cache-item.tmpl.c b/server/cache-item.tmpl.c
index 034f2ea..47de423 100644
--- a/server/cache-item.tmpl.c
+++ b/server/cache-item.tmpl.c
@@ -89,7 +89,7 @@ static int FUNC_NAME(add)(CHANNELCLIENT *channel_client, uint64_t id, size_t siz
     item = spice_new(RedCacheItem, 1);
 
     channel_client->priv->VAR_NAME(available) -= size;
-    verify(SPICE_OFFSETOF(RedCacheItem, u.cache_data.lru_link) == 0);
+    SPICE_VERIFY(SPICE_OFFSETOF(RedCacheItem, u.cache_data.lru_link) == 0);
     while (channel_client->priv->VAR_NAME(available) < 0) {
         RedCacheItem *tail = (RedCacheItem *)ring_get_tail(&channel_client->priv->VAR_NAME(lru));
         if (!tail) {
diff --git a/server/dcc.c b/server/dcc.c
index 17f9300..fc2efbc 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -981,7 +981,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
         NewCacheItem *tail;
         NewCacheItem **now;
 
-        verify(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
+        SPICE_VERIFY(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
         if (!(tail = (NewCacheItem *)ring_get_tail(&cache->lru)) ||
                                                    tail->sync[dcc->priv->id] == serial) {
             cache->available += size;
diff --git a/server/display-channel.c b/server/display-channel.c
index bcdde13..46191b0 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -640,7 +640,7 @@ static void exclude_region(DisplayChannel *display, Ring *ring, RingItem *ring_i
                 ring_item = now->siblings_link.prev;
                 current_remove(display, now);
                 if (last && *last == now) {
-                    verify(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
+                    SPICE_VERIFY(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
                     *last = (TreeItem *)ring_next(ring, ring_item);
                 }
             } else if (now->type == TREE_ITEM_TYPE_CONTAINER) {
@@ -659,7 +659,7 @@ static void exclude_region(DisplayChannel *display, Ring *ring, RingItem *ring_i
             }
         }
 
-        verify(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
+        SPICE_VERIFY(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
         while ((last && *last == (TreeItem *)ring_item) ||
                !(ring_item = ring_next(ring, ring_item))) {
             if (ring == top_ring) {
diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c
index 3d5f8a0..125b61c 100644
--- a/server/gstreamer-encoder.c
+++ b/server/gstreamer-encoder.c
@@ -1691,7 +1691,7 @@ VideoEncoder *gstreamer_encoder_new(SpiceVideoCodecType codec_type,
                                     bitmap_ref_t bitmap_ref,
                                     bitmap_unref_t bitmap_unref)
 {
-    verify(SPICE_GST_FRAME_STATISTICS_COUNT <= SPICE_GST_HISTORY_SIZE);
+    SPICE_VERIFY(SPICE_GST_FRAME_STATISTICS_COUNT <= SPICE_GST_HISTORY_SIZE);
     spice_return_val_if_fail(codec_type == SPICE_VIDEO_CODEC_TYPE_MJPEG ||
                              codec_type == SPICE_VIDEO_CODEC_TYPE_VP8 ||
                              codec_type == SPICE_VIDEO_CODEC_TYPE_H264, NULL);
diff --git a/server/image-cache.c b/server/image-cache.c
index 5e6a59f..7005814 100644
--- a/server/image-cache.c
+++ b/server/image-cache.c
@@ -79,7 +79,7 @@ static void image_cache_put(SpiceImageCache *spice_cache, uint64_t id, pixman_im
 
 #ifndef IMAGE_CACHE_AGE
     if (cache->num_items == IMAGE_CACHE_MAX_ITEMS) {
-        verify(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
+        SPICE_VERIFY(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
         ImageCacheItem *tail = (ImageCacheItem *)ring_get_tail(&cache->lru);
         spice_assert(tail);
         image_cache_remove(cache, tail);
@@ -134,7 +134,7 @@ void image_cache_reset(ImageCache *cache)
 {
     ImageCacheItem *item;
 
-    verify(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
+    SPICE_VERIFY(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
     while ((item = (ImageCacheItem *)ring_get_head(&cache->lru))) {
         image_cache_remove(cache, item);
     }
@@ -147,7 +147,7 @@ void image_cache_reset(ImageCache *cache)
 
 void image_cache_aging(ImageCache *cache)
 {
-    verify(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
+    SPICE_VERIFY(SPICE_OFFSETOF(ImageCacheItem, lru_link) == 0);
 #ifdef IMAGE_CACHE_AGE
     ImageCacheItem *item;
 
diff --git a/server/pixmap-cache.c b/server/pixmap-cache.c
index 60847c3..5a5eba7 100644
--- a/server/pixmap-cache.c
+++ b/server/pixmap-cache.c
@@ -46,7 +46,7 @@ void pixmap_cache_clear(PixmapCache *cache)
         cache->frozen = FALSE;
     }
 
-    verify(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
+    SPICE_VERIFY(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
     while ((item = (NewCacheItem *)ring_get_head(&cache->lru))) {
         ring_remove(&item->lru_link);
         free(item);
diff --git a/server/tree.c b/server/tree.c
index 7da8d7d..c0e125c 100644
--- a/server/tree.c
+++ b/server/tree.c
@@ -240,7 +240,7 @@ void container_cleanup(Container *container)
     while (container && container->items.next == container->items.prev) {
         Container *next = container->base.container;
         if (container->items.next != &container->items) {
-            verify(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
+            SPICE_VERIFY(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
             TreeItem *item = (TreeItem *)ring_get_head(&container->items);
             spice_assert(item);
             ring_remove(&item->siblings_link);
@@ -256,7 +256,7 @@ void container_cleanup(Container *container)
 Shadow* tree_item_find_shadow(TreeItem *item)
 {
     while (item->type == TREE_ITEM_TYPE_CONTAINER) {
-        verify(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
+        SPICE_VERIFY(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
         if (!(item = (TreeItem *)ring_get_tail(&CONTAINER(item)->items))) {
             return NULL;
         }
diff --git a/spice-common b/spice-common
index 38047fb..4db46af 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 38047fb46f7e1211bbc20d9a81c8fae19b8f8bf4
+Subproject commit 4db46af4f7f55c3a72ef70ec000585982b28a6f9
-- 
2.7.4



More information about the Spice-devel mailing list