[gcr] gck: Make gck_attributes_unref take a pointer



commit 44aac490b6866c01d81975de2094899ed843bbc1
Author: Stef Walter <stefw collabora co uk>
Date:   Tue Nov 15 18:09:48 2011 +0100

    gck: Make gck_attributes_unref take a pointer
    
     * So it can be used as a GDestroyNotify

 gck/gck-attributes.c |   21 +++++++++++----------
 gck/gck.h            |    2 +-
 2 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/gck/gck-attributes.c b/gck/gck-attributes.c
index b94648e..bb3d513 100644
--- a/gck/gck-attributes.c
+++ b/gck/gck-attributes.c
@@ -1375,21 +1375,22 @@ gck_attributes_ref (GckAttributes *attrs)
  * When all outstanding references are NULL, the array will be freed.
  */
 void
-gck_attributes_unref (GckAttributes *attrs)
+gck_attributes_unref (gpointer attrs)
 {
+	GckAttributes *attrs_ = attrs;
 	guint i;
 
-	if (!attrs)
+	if (!attrs_)
 		return;
 
-	if (g_atomic_int_dec_and_test (&attrs->refs)) {
-		g_return_if_fail (attrs->array);
-		g_return_if_fail (!attrs->locked);
-		for (i = 0; i < attrs->array->len; ++i)
-			attribute_clear (gck_attributes_at (attrs, i), attrs->allocator);
-		g_array_free (attrs->array, TRUE);
-		attrs->array = NULL;
-		g_slice_free (GckAttributes, attrs);
+	if (g_atomic_int_dec_and_test (&attrs_->refs)) {
+		g_return_if_fail (attrs_->array);
+		g_return_if_fail (!attrs_->locked);
+		for (i = 0; i < attrs_->array->len; ++i)
+			attribute_clear (gck_attributes_at (attrs_, i), attrs_->allocator);
+		g_array_free (attrs_->array, TRUE);
+		attrs_->array = NULL;
+		g_slice_free (GckAttributes, attrs_);
 	}
 }
 
diff --git a/gck/gck.h b/gck/gck.h
index e9dbf9b..ee6eacd 100644
--- a/gck/gck.h
+++ b/gck/gck.h
@@ -275,7 +275,7 @@ gulong              gck_attributes_count                    (GckAttributes *attr
 
 GckAttributes*      gck_attributes_ref                      (GckAttributes *attrs);
 
-void                gck_attributes_unref                    (GckAttributes *attrs);
+void                gck_attributes_unref                    (gpointer attrs);
 
 gboolean            gck_attributes_contains                 (GckAttributes *attrs,
                                                              GckAttribute *match);



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