On Tue, 2016-06-14 at 10:14 -0500, Jonathon Jongsma wrote: > Rename this function to red_glz_drawable_free() and remove the > ImageEncoders argument since the RedGlzDrawable already holds a pointer > to the ImageEncoders structure > --- > server/dcc-encoders.c | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c > index 32908d0..4049eec 100644 > --- a/server/dcc-encoders.c > +++ b/server/dcc-encoders.c > @@ -534,14 +534,15 @@ static void > glz_drawable_instance_item_free(GlzDrawableInstanceItem *instance) > * if possible. > * NOTE - the caller should prevent encoding using the dictionary during this > operation > */ > -static void image_encoders_free_glz_drawable(ImageEncoders *enc, > RedGlzDrawable *drawable) > +static void red_glz_drawable_free(RedGlzDrawable *glz_drawable) I renamed the argument from drawable to glz_drawable to avoid confusion between Drawable and RedGlzDrawable types, but perhaps that change should not be included in this patch as it's unrelated the the main goal of the patch. > { > - RingItem *head_instance = ring_get_head(&drawable->instances); > + ImageEncoders *enc = glz_drawable->encoders; > + RingItem *head_instance = ring_get_head(&glz_drawable->instances); > int cont = (head_instance != NULL); > > while (cont) { > - if (drawable->instances_count == 1) { > - /* Last instance: image_encoders_free_glz_drawable_instance will > free the drawable */ > + if (glz_drawable->instances_count == 1) { > + /* Last instance: glz_drawable_instance_item_free will free the > glz_drawable */ > cont = FALSE; > } > GlzDrawableInstanceItem *instance = SPICE_CONTAINEROF(head_instance, > @@ -556,7 +557,7 @@ static void image_encoders_free_glz_drawable(ImageEncoders > *enc, RedGlzDrawable > glz_drawable_instance_item_free(instance); > > if (cont) { > - head_instance = ring_get_head(&drawable->instances); > + head_instance = ring_get_head(&glz_drawable->instances); > } > } > } > @@ -593,7 +594,7 @@ int > image_encoders_free_some_independent_glz_drawables(ImageEncoders *enc) > RedGlzDrawable *glz_drawable = SPICE_CONTAINEROF(ring_link, > RedGlzDrawable, link); > ring_link = ring_next(&enc->glz_drawables, ring_link); > if (!glz_drawable->has_drawable) { > - image_encoders_free_glz_drawable(enc, glz_drawable); > + red_glz_drawable_free(glz_drawable); > n++; > } > } > @@ -634,7 +635,7 @@ void image_encoders_free_glz_drawables(ImageEncoders *enc) > RedGlzDrawable *drawable = SPICE_CONTAINEROF(ring_link, > RedGlzDrawable, link); > // no need to lock the to_free list, since we assured no other thread > is encoding and > // thus not other thread access the to_free list of the channel > - image_encoders_free_glz_drawable(enc, drawable); > + red_glz_drawable_free(drawable); > } > pthread_rwlock_unlock(&glz_dict->encode_lock); > } > @@ -644,7 +645,7 @@ void image_encoders_glz_free_from_drawable_ring(Ring > *drawable_ring) > RingItem *glz_item, *next_item; > RedGlzDrawable *glz; > SAFE_FOREACH(glz_item, next_item, TRUE, drawable_ring, glz, > LINK_TO_GLZ(glz_item)) { > - image_encoders_free_glz_drawable(glz->encoders, glz); > + red_glz_drawable_free(glz); > } > } > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel