[Spice-devel] [PATCH spice-server v2 21/23] pixmap-cache: Use GLib memory functions
Frediano Ziglio
fziglio at redhat.com
Wed Sep 20 07:51:14 UTC 2017
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc.c | 8 ++++----
server/pixmap-cache.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/server/dcc.c b/server/dcc.c
index 315da75d2..2c1761d28 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -959,7 +959,7 @@ bool dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
spice_assert(size > 0);
- item = spice_new(NewCacheItem, 1);
+ item = g_new(NewCacheItem, 1);
serial = red_channel_client_get_message_serial(RED_CHANNEL_CLIENT(dcc));
if (cache->generation != dcc->priv->pixmap_cache_generation) {
@@ -968,7 +968,7 @@ bool dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
RED_CHANNEL_CLIENT(dcc), RED_PIPE_ITEM_TYPE_PIXMAP_SYNC);
dcc->priv->pending_pixmaps_sync = TRUE;
}
- free(item);
+ g_free(item);
return FALSE;
}
@@ -981,7 +981,7 @@ bool dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
if (!(tail = (NewCacheItem *)ring_get_tail(&cache->lru)) ||
tail->sync[dcc->priv->id] == serial) {
cache->available += size;
- free(item);
+ g_free(item);
return FALSE;
}
@@ -999,7 +999,7 @@ bool dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
cache->available += tail->size;
cache->sync[dcc->priv->id] = serial;
dcc_push_release(dcc, SPICE_RES_TYPE_PIXMAP, tail->id, tail->sync);
- free(tail);
+ g_free(tail);
}
++cache->items;
item->next = cache->hash_table[(key = BITS_CACHE_HASH_KEY(id))];
diff --git a/server/pixmap-cache.c b/server/pixmap-cache.c
index f8b8a8a74..0a4b9207f 100644
--- a/server/pixmap-cache.c
+++ b/server/pixmap-cache.c
@@ -49,7 +49,7 @@ void pixmap_cache_clear(PixmapCache *cache)
SPICE_VERIFY(SPICE_OFFSETOF(NewCacheItem, lru_link) == 0);
while ((item = (NewCacheItem *)ring_get_head(&cache->lru))) {
ring_remove(&item->lru_link);
- free(item);
+ g_free(item);
}
memset(cache->hash_table, 0, sizeof(*cache->hash_table) * BITS_CACHE_HASH_SIZE);
@@ -92,7 +92,7 @@ static Ring pixmap_cache_list = {&pixmap_cache_list, &pixmap_cache_list};
static PixmapCache *pixmap_cache_new(RedClient *client, uint8_t id, int64_t size)
{
- PixmapCache *cache = spice_new0(PixmapCache, 1);
+ PixmapCache *cache = g_new0(PixmapCache, 1);
ring_item_init(&cache->base);
pthread_mutex_init(&cache->lock, NULL);
@@ -143,5 +143,5 @@ void pixmap_cache_unref(PixmapCache *cache)
ring_remove(&cache->base);
pthread_mutex_unlock(&cache_lock);
pixmap_cache_destroy(cache);
- free(cache);
+ g_free(cache);
}
--
2.13.5
More information about the Spice-devel
mailing list