[Spice-devel] [PATCH spice-gtk 03/10] display: replace ring with hashtable

Christophe Fergeau cfergeau at redhat.com
Mon Sep 9 23:16:10 PDT 2013


On Mon, Sep 09, 2013 at 11:04:51AM +0300, Uri Lublin wrote:
> On 09/09/2013 10:58 AM, Uri Lublin wrote:
> >Hi Marc-Andre,
> >
> >See my comment below.
> >
> >On 09/08/2013 09:59 PM, Marc-André Lureau wrote:
> >>diff --git a/gtk/channel-display.c b/gtk/channel-display.c
> >>index eab1742..7a66558 100644
> >>--- a/gtk/channel-display.c
> >>+++ b/gtk/channel-display.c
> >>
> >>@@ -705,7 +706,7 @@ static void
> >>spice_display_channel_init(SpiceDisplayChannel *channel)
> >>        c = channel->priv = SPICE_DISPLAY_CHANNEL_GET_PRIVATE(channel);
> >>  -    ring_init(&c->surfaces);
> >>+    c->surfaces = g_hash_table_new(NULL, NULL);
> >>      c->image_cache.ops = &image_cache_ops;
> >>      c->palette_cache.ops = &palette_cache_ops;
> >>      c->image_surfaces.ops = &image_surfaces_ops;
> >>@@ -740,7 +741,8 @@ static int create_canvas(SpiceChannel
> >>*channel, display_surface *surface)
> >>              }
> >>                emit_main_context(channel,
> >>SPICE_DISPLAY_PRIMARY_DESTROY);
> >>-            ring_remove(&primary->link);
> >>+
> >>+            g_hash_table_remove(c->surfaces, 0);
> >
> >Use primary->surface_id (instead of 0) as key:
> >g_hash_table_remove(c->surfaces, GINT_TO_POINTER(primary->surface_id))
> >
> 
> I see you are doing it in a following patch, so disregard.

For what it's worth, I'd have a slight preference for using
GINT_TO_POINTER(0) rather than 0 here.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130910/2c8483e4/attachment.pgp>


More information about the Spice-devel mailing list