[gcr/wip/gcr4] gck: Remove GckList




commit 40bc939d53c21a91edddf0e01b899d5c4a40741e
Author: Corentin Noël <corentin noel collabora com>
Date:   Tue Oct 5 09:45:10 2021 +0200

    gck: Remove GckList
    
    This was a simple shadowing of GList, just use the real type instead.
    
    Also rename gck_error_get_quark to gck_error_quark to follow GLib conventions.

 gck/gck-attributes.h           | 17 ++++-----
 gck/gck-enumerator.c           | 16 +++-----
 gck/gck-misc.c                 | 83 ++++--------------------------------------
 gck/gck-module.c               |  2 +-
 gck/gck-modules.c              | 18 ++++-----
 gck/test-gck-crypto.c          |  6 +--
 gck/test-gck-enumerator.c      | 21 +++++------
 gck/test-gck-modules.c         |  9 ++---
 gck/test-gck-object.c          |  8 ++--
 gck/test-gck-session.c         |  2 +-
 gck/test-gck-slot.c            |  4 +-
 gcr/frob-certificate-request.c |  2 +-
 gcr/gcr-library.c              | 17 ++++-----
 gcr/gcr-pkcs11-certificate.c   |  2 +-
 gcr/gcr-pkcs11-importer.c      | 18 ++++-----
 gcr/gcr-subject-public-key.c   |  2 +-
 gcr/gcr-trust.c                | 12 +++---
 gcr/test-certificate-chain.c   |  2 +-
 gcr/test-pkcs11-certificate.c  |  2 +-
 gcr/test-trust.c               |  2 +-
 ui/gcr-import-button.c         |  8 ++--
 21 files changed, 85 insertions(+), 168 deletions(-)
---
diff --git a/gck/gck-attributes.h b/gck/gck-attributes.h
index e13303c..4656773 100644
--- a/gck/gck-attributes.h
+++ b/gck/gck-attributes.h
@@ -24,17 +24,14 @@ typedef enum {
        GCK_ERROR_MODULE_PROBLEM = (CKR_VENDOR_DEFINED | (GCK_VENDOR_CODE + 1)),
 } GckError;
 
-#define             GCK_ERROR                               (gck_error_get_quark ())
-
-GQuark              gck_error_get_quark                     (void) G_GNUC_CONST;
-
-#define             GCK_TYPE_LIST                           (gck_list_get_boxed_type ())
-
-GType               gck_list_get_boxed_type                 (void) G_GNUC_CONST;
-
-GList*              gck_list_ref_copy                       (GList *reflist);
+/**
+ * GCK_ERROR:
+ *
+ * The error domain for gck library errors.
+ */
+#define             GCK_ERROR                               (gck_error_quark ())
 
-void                gck_list_unref_free                     (GList *reflist);
+GQuark              gck_error_quark                         (void) G_GNUC_CONST;
 
 const gchar*        gck_message_from_rv                     (gulong rv);
 
diff --git a/gck/gck-enumerator.c b/gck/gck-enumerator.c
index f7ae6eb..96b0a08 100644
--- a/gck/gck-enumerator.c
+++ b/gck/gck-enumerator.c
@@ -196,9 +196,7 @@ cleanup_state (GckEnumeratorState *args)
                args->results = NULL;
        }
 
-       gck_list_unref_free (args->modules);
-       args->modules = NULL;
-
+       g_clear_list (&args->modules, g_object_unref);
        g_clear_object (&args->interaction);
 
        if (args->object_class)
@@ -314,9 +312,7 @@ state_slots (GckEnumeratorState *args, gboolean forward)
 
        /* slots state to modules state */
        } else {
-
-               gck_list_unref_free (args->slots);
-               args->slots = NULL;
+               g_clear_list (&args->slots, g_object_unref);
                return state_modules;
        }
 }
@@ -719,7 +715,7 @@ _gck_enumerator_new_for_modules (GList *modules,
 
        state->session_options = session_options;
 
-       state->modules = gck_list_ref_copy (modules);
+       state->modules = g_list_copy_deep (modules, (GCopyFunc) g_object_ref, NULL);
        state->slots = NULL;
        state->handler = state_modules;
        state->match = uri_data;
@@ -741,7 +737,7 @@ _gck_enumerator_new_for_slots (GList *slots,
 
        state->session_options = session_options;
 
-       state->slots = gck_list_ref_copy (slots);
+       state->slots = g_list_copy_deep (slots, (GCopyFunc) g_object_ref, NULL);
        state->modules = NULL;
        state->handler = state_slots;
        state->match = uri_data;
@@ -1236,7 +1232,7 @@ gck_enumerator_next (GckEnumerator *self,
  * whether a failure occurred or not.
  *
  * Returns: (transfer full) (element-type Gck.Object): A list of objects, which
- * should be freed using gck_list_unref_free().
+ * should be freed using g_list_free_full(list, g_object_unref).
  */
 GList *
 gck_enumerator_next_n (GckEnumerator *self,
@@ -1331,7 +1327,7 @@ gck_enumerator_next_async (GckEnumerator *self, gint max_objects, GCancellable *
  * whether a failure occurred or not.
  *
  * Returns: (element-type Gck.Object) (transfer full): The list of objects, which
- * should be freed with gck_list_unref_free()
+ * should be freed with g_list_free_full(list, g_object_unref)
  */
 GList*
 gck_enumerator_next_finish (GckEnumerator *self, GAsyncResult *result, GError **error)
diff --git a/gck/gck-misc.c b/gck/gck-misc.c
index e44241b..eed16fa 100644
--- a/gck/gck-misc.c
+++ b/gck/gck-misc.c
@@ -24,6 +24,7 @@
 
 #include "gck.h"
 #include "gck-private.h"
+#include "gck-attributes.h"
 
 #include "egg/egg-secure-memory.h"
 
@@ -123,31 +124,13 @@ EGG_SECURE_DEFINE_GLIB_GLOBALS ();
  */
 
 /**
- * GCK_ERROR:
+ * gck_error_quark:
  *
- * The error domain for gck library errors.
- */
-
-GQuark
-gck_get_error_quark (void)
-{
-       /* This is the deprecated version */
-       return gck_error_get_quark ();
-}
-
-GQuark
-gck_error_get_quark (void)
-{
-       static GQuark domain = 0;
-       static size_t quark_inited = 0;
-
-       if (g_once_init_enter (&quark_inited)) {
-               domain = g_quark_from_static_string ("gck-error");
-               g_once_init_leave (&quark_inited, 1);
-       }
-
-       return domain;
-}
+ * Gets the Gck Error Quark.
+ *
+ * Returns: a #GQuark.
+ **/
+G_DEFINE_QUARK(gck-error, gck_error)
 
 /**
  * gck_message_from_rv:
@@ -296,58 +279,6 @@ _gck_rv_from_error (GError *error,
  * library or PKCS11 in general.
  */
 
-GType
-gck_list_get_boxed_type (void)
-{
-       static GType type = 0;
-       if (!type)
-               type = g_boxed_type_register_static ("GckList",
-                                                    (GBoxedCopyFunc)gck_list_ref_copy,
-                                                    (GBoxedFreeFunc)gck_list_unref_free);
-       return type;
-
-}
-
-/**
- * gck_list_unref_free: (skip)
- * @reflist: (element-type GObject.Object): list of Gobject reference counted pointers
- *
- * Free a list of GObject based pointers. All objects in the list
- * will be unreffed and then the list itself will be freed.
- **/
-void
-gck_list_unref_free (GList *reflist)
-{
-       GList *l;
-       for (l = reflist; l; l = g_list_next (l)) {
-               g_return_if_fail (G_IS_OBJECT (l->data));
-               g_object_unref (l->data);
-       }
-       g_list_free (reflist);
-}
-
-/**
- * gck_list_ref_copy: (skip)
- * @reflist: (element-type GObject.Object): list of GObject reference counted
- *           objects
- *
- * Copy a list of GObject based pointers. All objects
- * in the list will be reffed and the list will be copied.
- *
- * Return value: (transfer full) (element-type GObject.Object): the copied and
- *               reffed list, when done, free it with gck_list_unref_free ()
- **/
-GList *
-gck_list_ref_copy (GList *reflist)
-{
-       GList *l, *copy = g_list_copy (reflist);
-       for (l = copy; l; l = g_list_next (l)) {
-               g_return_val_if_fail (G_IS_OBJECT (l->data), NULL);
-               g_object_ref (l->data);
-       }
-       return copy;
-}
-
 /**
  * gck_string_from_chars: (skip)
  * @data: The character data to turn into a null terminated string.
diff --git a/gck/gck-module.c b/gck/gck-module.c
index c5cc0ee..02a186e 100644
--- a/gck/gck-module.c
+++ b/gck/gck-module.c
@@ -608,7 +608,7 @@ gck_module_get_info (GckModule *self)
  * Get the GckSlot objects for a given module.
  *
  * Return value: (element-type Gck.Slot) (transfer full): The possibly empty
- *               list of slots. Release this with gck_list_unref_free().
+ *               list of slots. Release this with g_list_free_full(list, g_object_unref).
  */
 GList*
 gck_module_get_slots (GckModule *self, gboolean token_present)
diff --git a/gck/gck-modules.c b/gck/gck-modules.c
index 804999d..2971451 100644
--- a/gck/gck-modules.c
+++ b/gck/gck-modules.c
@@ -76,7 +76,7 @@ static void
 free_initialize_registered (InitializeRegistered *args)
 {
        g_clear_error (&args->error);
-       gck_list_unref_free (args->results);
+       g_clear_list (&args->results, g_object_unref);
        g_free (args);
 }
 
@@ -88,7 +88,7 @@ free_initialize_registered (InitializeRegistered *args)
  * Load and initialize all the registered modules.
  *
  * Returns: (transfer full) (element-type Gck.Module): A newly allocated list
- * of #GckModule objects, which should be released with gck_list_unref_free().
+ * of #GckModule objects, which should be released with g_list_free_full(list, g_object_unref).
  */
 GList*
 gck_modules_initialize_registered (GCancellable *cancellable,
@@ -172,7 +172,7 @@ gck_modules_initialize_registered_finish (GAsyncResult *result,
  * Get a list of slots for across all of the modules.
  *
  * Returns: (transfer full) (element-type Gck.Slot): A list of #GckSlot
- * objects, which should be freed with gck_list_unref_free().
+ * objects, which should be freed with g_list_free_full(list, g_object_unref).
  */
 GList*
 gck_modules_get_slots (GList *modules, gboolean token_present)
@@ -262,7 +262,7 @@ tokens_for_uri (GList *modules,
                                        gck_token_info_free (token_info);
                                }
                        }
-                       gck_list_unref_free (slots);
+                       g_list_free_full (slots, g_object_unref);
                }
        }
 
@@ -294,7 +294,7 @@ gck_modules_token_for_uri (GList *modules,
        results = tokens_for_uri (modules, uri, TRUE, error);
        if (results)
                slot = g_object_ref (results->data);
-       gck_list_unref_free (results);
+       g_list_free_full (results, g_object_unref);
 
        return slot;
 }
@@ -308,8 +308,8 @@ gck_modules_token_for_uri (GList *modules,
  * Lookup a token that matches the URI.
  *
  * Returns: (transfer full) (element-type Gck.Slot): A list of newly allocated
- * #GckSlot objects. Use gck_list_unref_free() to release the list once you're
- * done with it.
+ * #GckSlot objects. Use g_list_free_full(list, g_object_unref) to release the
+ * list once you're done with it.
  */
 GList *
 gck_modules_tokens_for_uri (GList *modules,
@@ -371,8 +371,8 @@ gck_modules_object_for_uri (GList *modules,
  * version.
  *
  * Returns: (transfer full) (element-type Gck.Object): A list of #GckObject which
- * should be released with gck_list_unref_free(), or %NULL if no matching object
- * was found.
+ * should be released with g_list_free_full(list, g_object_unref), or %NULL if
+ * no matching object was found.
  */
 GList*
 gck_modules_objects_for_uri (GList *modules,
diff --git a/gck/test-gck-crypto.c b/gck/test-gck-crypto.c
index b7e2118..27dee9a 100644
--- a/gck/test-gck-crypto.c
+++ b/gck/test-gck-crypto.c
@@ -78,7 +78,7 @@ setup (Test *test, gconstpointer unused)
        g_object_add_weak_pointer (G_OBJECT (test->session_with_auth), (gpointer *)&test->session_with_auth);
 
        g_object_unref (slot);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 }
 
 static void
@@ -136,7 +136,7 @@ find_key (GckSession *session, CK_ATTRIBUTE_TYPE method, CK_MECHANISM_TYPE mech)
                break;
        }
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        return object;
 }
 
@@ -152,7 +152,7 @@ find_key_with_value (GckSession *session, const gchar *value)
        g_assert_nonnull (objects);
 
        object = g_object_ref (objects->data);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        return object;
 }
 
diff --git a/gck/test-gck-enumerator.c b/gck/test-gck-enumerator.c
index e7ad139..00ece25 100644
--- a/gck/test-gck-enumerator.c
+++ b/gck/test-gck-enumerator.c
@@ -59,8 +59,7 @@ setup (Test *test, gconstpointer unused)
 static void
 teardown (Test *test, gconstpointer unused)
 {
-       gck_list_unref_free (test->modules);
-
+       g_clear_list (&test->modules, g_object_unref);
        g_object_unref (test->module);
        egg_test_wait_for_gtask_thread (test->module);
        g_assert_null (test->module);
@@ -95,7 +94,7 @@ test_create_slots (Test *test, gconstpointer unused)
        en = _gck_enumerator_new_for_slots (slots, 0, uri_data);
        g_assert_true (GCK_IS_ENUMERATOR (en));
        g_object_unref (en);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 }
 
 static void
@@ -136,7 +135,7 @@ test_next_slots (Test *test, gconstpointer unused)
 
        g_object_unref (obj);
        g_object_unref (en);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 }
 
 static void
@@ -184,7 +183,7 @@ test_next_n (Test *test, gconstpointer unused)
        for (l = objects; l; l = g_list_next (l))
                g_assert_true (GCK_IS_OBJECT (l->data));
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -220,7 +219,7 @@ test_next_async (Test *test, gconstpointer unused)
                g_assert_true (GCK_IS_OBJECT (l->data));
 
        g_object_unref (result);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -252,7 +251,7 @@ test_enumerate_session (Test *test,
        g_object_unref (obj);
        g_object_unref (en);
        g_object_unref (session);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 }
 
 static void
@@ -275,7 +274,7 @@ test_attribute_match (Test *test, gconstpointer unused)
        g_assert_cmpint (g_list_length (objects), ==, 1);
        g_assert_true (GCK_IS_OBJECT (objects->data));
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -383,7 +382,7 @@ test_token_match (Test *test, gconstpointer unused)
        g_assert_cmpint (g_list_length (objects), ==, 0);
        g_assert_no_error (error);
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -529,7 +528,7 @@ test_attribute_get (Test *test,
                g_assert_nonnull (mock->attrs);
        }
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -598,7 +597,7 @@ test_chained (Test *test,
        g_assert_no_error (error);
        g_assert_cmpint (g_list_length (objects), ==, 5);
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (one);
 }
 
diff --git a/gck/test-gck-modules.c b/gck/test-gck-modules.c
index 6ef994e..06d81fa 100644
--- a/gck/test-gck-modules.c
+++ b/gck/test-gck-modules.c
@@ -57,8 +57,7 @@ setup (Test *test, gconstpointer unused)
 static void
 teardown (Test *test, gconstpointer unused)
 {
-       gck_list_unref_free (test->modules);
-       test->modules = NULL;
+       g_clear_list (&test->modules, g_object_unref);
 }
 
 static void
@@ -78,7 +77,7 @@ test_enumerate_objects (Test *test, gconstpointer unused)
        g_assert_cmpint (g_list_length (objects), ==, 1);
        g_assert_true (GCK_IS_OBJECT (objects->data));
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        g_object_unref (en);
 }
 
@@ -163,7 +162,7 @@ test_objects_for_uri (Test *test, gconstpointer unused)
        g_assert_no_error (error);
        g_assert_cmpint (g_list_length (objects), ==, 5);
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 }
 
 static void
@@ -182,7 +181,7 @@ test_enumerate_uri (Test *test, gconstpointer unused)
        g_assert_no_error (error);
 
        g_object_unref (en);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 }
 
 int
diff --git a/gck/test-gck-object.c b/gck/test-gck-object.c
index 4741898..0c36398 100644
--- a/gck/test-gck-object.c
+++ b/gck/test-gck-object.c
@@ -58,7 +58,7 @@ setup (Test *test, gconstpointer unused)
 
        test->slot = GCK_SLOT (slots->data);
        g_object_ref (test->slot);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        test->session = gck_slot_open_session (test->slot, 0, NULL, &err);
        g_assert_no_error (err);
@@ -374,13 +374,13 @@ test_find_objects (Test *test, gconstpointer unused)
        objects = gck_session_find_objects (test->session, gck_builder_end (&builder), NULL, &err);
        g_assert_no_error (err);
        g_assert_cmpuint (g_list_length (objects), ==, 1);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 
        /* Full, All */
        objects = gck_session_find_objects (test->session, gck_builder_end (&builder), NULL, &err);
        g_assert_no_error (err);
        g_assert_cmpuint (g_list_length (objects), >, 1);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 
        /* Async, None */
        gck_builder_add_string (&builder, CKA_LABEL, "blah blah");
@@ -391,7 +391,7 @@ test_find_objects (Test *test, gconstpointer unused)
        objects = gck_session_find_objects_finish (test->session, result, &err);
        g_object_unref (result);
        g_assert_null (objects);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 }
 
 int
diff --git a/gck/test-gck-session.c b/gck/test-gck-session.c
index 0a296df..5a0968e 100644
--- a/gck/test-gck-session.c
+++ b/gck/test-gck-session.c
@@ -58,7 +58,7 @@ setup (Test *test, gconstpointer unused)
 
        test->slot = GCK_SLOT (slots->data);
        g_object_ref (test->slot);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
        g_object_add_weak_pointer (G_OBJECT (test->slot), (gpointer *)&test->slot);
 
        test->session = gck_slot_open_session (test->slot, 0, NULL, &err);
diff --git a/gck/test-gck-slot.c b/gck/test-gck-slot.c
index 4cfddbe..1c349ea 100644
--- a/gck/test-gck-slot.c
+++ b/gck/test-gck-slot.c
@@ -53,7 +53,7 @@ setup (Test *test, gconstpointer unused)
 
        test->slot = GCK_SLOT (slots->data);
        g_object_ref (test->slot);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
 }
 
@@ -120,7 +120,7 @@ test_slot_info (Test *test, gconstpointer unused)
                gck_slot_info_free (info);
        }
 
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 }
 
 static void
diff --git a/gcr/frob-certificate-request.c b/gcr/frob-certificate-request.c
index 6801b8c..12e01b9 100644
--- a/gcr/frob-certificate-request.c
+++ b/gcr/frob-certificate-request.c
@@ -48,7 +48,7 @@ load_key_for_uri (const gchar *uri)
        modules = gcr_pkcs11_get_modules ();
        enumerator = gck_modules_enumerate_uri (modules, uri, GCK_SESSION_LOGIN_USER |
                                                GCK_SESSION_READ_ONLY, &error);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        interaction = console_interaction_new ();
        gck_enumerator_set_interaction (enumerator, interaction);
diff --git a/gcr/gcr-library.c b/gcr/gcr-library.c
index dad981b..3ee1eeb 100644
--- a/gcr/gcr-library.c
+++ b/gcr/gcr-library.c
@@ -143,8 +143,7 @@ _gcr_uninitialize_library (void)
 {
        G_LOCK (modules);
 
-       gck_list_unref_free (all_modules);
-       all_modules = NULL;
+       g_clear_list (&all_modules, g_object_unref);
        initialized_modules = FALSE;
 
        G_UNLOCK (modules);
@@ -249,7 +248,7 @@ on_initialize_registered (GObject *object,
        }
        G_UNLOCK (modules);
 
-       gck_list_unref_free (results);
+       g_list_free_full (results, g_object_unref);
 
        g_debug ("completed initialize of registered modules");
        g_task_return_boolean (task, TRUE);
@@ -349,7 +348,7 @@ gcr_pkcs11_initialize (GCancellable *cancellable,
                g_propagate_error (error, err);
        }
 
-       gck_list_unref_free (results);
+       g_list_free_full (results, g_object_unref);
        return (err == NULL);
 }
 
@@ -362,7 +361,7 @@ gcr_pkcs11_initialize (GCancellable *cancellable,
  * An empty list of modules will be returned if gcr_pkcs11_set_modules(),
  * or gcr_pkcs11_initialize() has not yet run.
  *
- * When done with the list, free it with gck_list_unref_free().
+ * When done with the list, free it with g_list_free_full (list, g_object_unref).
  *
  * Returns: (transfer full) (element-type Gck.Module): a newly allocated list
  *          of #GckModule objects
@@ -374,7 +373,7 @@ gcr_pkcs11_get_modules (void)
                g_debug ("pkcs11 not yet initialized");
        else if (!all_modules)
                g_debug ("no modules loaded");
-       return gck_list_ref_copy (all_modules);
+       return g_list_copy_deep (all_modules, (GCopyFunc) g_object_ref, NULL);
 }
 
 /**
@@ -396,8 +395,8 @@ gcr_pkcs11_set_modules (GList *modules)
        for (l = modules; l; l = g_list_next (l))
                g_return_if_fail (GCK_IS_MODULE (l->data));
 
-       modules = gck_list_ref_copy (modules);
-       gck_list_unref_free (all_modules);
+       modules = g_list_copy_deep (modules, (GCopyFunc) g_object_ref, NULL);
+       g_list_free_full (all_modules, g_object_unref);
        all_modules = modules;
        initialized_modules = TRUE;
 }
@@ -514,7 +513,7 @@ gcr_pkcs11_get_trust_store_slot (void)
  * This will return an empty list if the gcr_pkcs11_initialize() function has
  * not yet been called.
  *
- * When done with the list, free it with gck_list_unref_free().
+ * When done with the list, free it with g_list_free_full(list, g_object_unref).
  *
  * Returns: (transfer full) (element-type Gck.Slot): a list of #GckSlot
  *          objects to use for lookup of trust, or the empty list if not
diff --git a/gcr/gcr-pkcs11-certificate.c b/gcr/gcr-pkcs11-certificate.c
index ea87961..34b6731 100644
--- a/gcr/gcr-pkcs11-certificate.c
+++ b/gcr/gcr-pkcs11-certificate.c
@@ -109,7 +109,7 @@ perform_lookup_certificate (GckAttributes *search,
 
        modules = gcr_pkcs11_get_modules ();
        en = gck_modules_enumerate_objects (modules, search, 0);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        object = gck_enumerator_next (en, cancellable, error);
        g_object_unref (en);
diff --git a/gcr/gcr-pkcs11-importer.c b/gcr/gcr-pkcs11-importer.c
index 302eb72..57c4925 100644
--- a/gcr/gcr-pkcs11-importer.c
+++ b/gcr/gcr-pkcs11-importer.c
@@ -546,8 +546,7 @@ _gcr_pkcs11_importer_dispose (GObject *obj)
 {
        GcrPkcs11Importer *self = GCR_PKCS11_IMPORTER (obj);
 
-       gck_list_unref_free (self->objects);
-       self->objects = NULL;
+       g_clear_list (&self->objects, g_object_unref);
        g_clear_object (&self->session);
        g_clear_object (&self->interaction);
 
@@ -654,7 +653,7 @@ _gcr_pkcs11_importer_get_property (GObject *obj,
                g_value_set_object (value, _gcr_pkcs11_importer_get_slot (self));
                break;
        case PROP_IMPORTED:
-               g_value_take_boxed (value, _gcr_pkcs11_importer_get_imported (self));
+               g_value_set_pointer (value, _gcr_pkcs11_importer_get_imported (self));
                break;
        case PROP_QUEUED:
                g_value_set_pointer (value, _gcr_pkcs11_importer_get_queued (self));
@@ -693,9 +692,8 @@ _gcr_pkcs11_importer_class_init (GcrPkcs11ImporterClass *klass)
                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
        g_object_class_install_property (gobject_class, PROP_IMPORTED,
-               g_param_spec_boxed ("imported", "Imported", "Imported objects",
-                                   GCK_TYPE_LIST,
-                                   G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+               g_param_spec_pointer ("imported", "Imported", "Imported objects",
+                                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
        g_object_class_install_property (gobject_class, PROP_QUEUED,
                g_param_spec_pointer ("queued", "Queued", "Queued attributes",
@@ -719,7 +717,7 @@ list_all_slots (void)
 
        modules = gcr_pkcs11_get_modules ();
        results = gck_modules_get_slots (modules, TRUE);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        return results;
 }
@@ -797,7 +795,7 @@ _gcr_pkcs11_importer_create_for_parsed (GcrParsed *parsed)
 
                gck_token_info_free (token_info);
        }
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        return g_list_reverse (results);
 }
@@ -887,14 +885,14 @@ GList *
 _gcr_pkcs11_importer_get_imported (GcrPkcs11Importer *self)
 {
        g_return_val_if_fail (GCR_IS_PKCS11_IMPORTER (self), NULL);
-       return g_list_copy (self->objects);
+       return self->objects;
 }
 
 GList *
 _gcr_pkcs11_importer_get_queued (GcrPkcs11Importer *self)
 {
        g_return_val_if_fail (GCR_IS_PKCS11_IMPORTER (self), NULL);
-       return g_list_copy (self->queue->head);
+       return self->queue->head;
 }
 
 void
diff --git a/gcr/gcr-subject-public-key.c b/gcr/gcr-subject-public-key.c
index 7ff78f4..494de05 100644
--- a/gcr/gcr-subject-public-key.c
+++ b/gcr/gcr-subject-public-key.c
@@ -219,7 +219,7 @@ lookup_public_key (GckObject *object,
                return NULL;
 
        result = g_object_ref (objects->data);
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
 
        return result;
 }
diff --git a/gcr/gcr-trust.c b/gcr/gcr-trust.c
index af41d02..bfd04a9 100644
--- a/gcr/gcr-trust.c
+++ b/gcr/gcr-trust.c
@@ -146,7 +146,7 @@ perform_is_certificate_pinned (GckAttributes *search,
        g_debug ("searching for pinned certificate in %d slots",
                 g_list_length (slots));
        en = gck_slots_enumerate_objects (slots, search, 0);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        object = gck_enumerator_next (en, cancellable, error);
        g_object_unref (en);
@@ -311,7 +311,7 @@ perform_add_pinned_certificate (GckAttributes *search,
 
        slots = gcr_pkcs11_get_trust_lookup_slots ();
        en = gck_slots_enumerate_objects (slots, search, CKF_RW_SESSION);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        object = gck_enumerator_next (en, cancellable, &lerr);
        g_object_unref (en);
@@ -513,7 +513,7 @@ perform_remove_pinned_certificate (GckAttributes *attrs,
 
        slots = gcr_pkcs11_get_trust_lookup_slots ();
        en = gck_slots_enumerate_objects (slots, attrs, CKF_RW_SESSION);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        /* We need an error below */
        if (error && !*error)
@@ -534,12 +534,12 @@ perform_remove_pinned_certificate (GckAttributes *attrs,
                                continue;
                        }
 
-                       gck_list_unref_free (objects);
+                       g_list_free_full (objects, g_object_unref);
                        return FALSE;
                }
        }
 
-       gck_list_unref_free (objects);
+       g_list_free_full (objects, g_object_unref);
        return TRUE;
 }
 
@@ -691,7 +691,7 @@ perform_is_certificate_anchored (GckAttributes *attrs,
        g_debug ("searching for certificate anchor in %d slots",
                 g_list_length (slots));
        en = gck_slots_enumerate_objects (slots, attrs, 0);
-       gck_list_unref_free (slots);
+       g_list_free_full (slots, g_object_unref);
 
        object = gck_enumerator_next (en, cancellable, error);
        g_object_unref (en);
diff --git a/gcr/test-certificate-chain.c b/gcr/test-certificate-chain.c
index a0bc45f..c4847da 100644
--- a/gcr/test-certificate-chain.c
+++ b/gcr/test-certificate-chain.c
@@ -162,7 +162,7 @@ setup (Test *test, gconstpointer unused)
        uris[1] = NULL;
        gcr_pkcs11_set_trust_lookup_uris (uris);
        gcr_pkcs11_set_trust_store_uri (GCK_MOCK_SLOT_ONE_URI);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        /* A self-signed certificate */
        if (!g_file_get_contents (SRCDIR "/gcr/fixtures/der-certificate.crt", &contents, &n_contents, NULL))
diff --git a/gcr/test-pkcs11-certificate.c b/gcr/test-pkcs11-certificate.c
index e1858ce..34b30d6 100644
--- a/gcr/test-pkcs11-certificate.c
+++ b/gcr/test-pkcs11-certificate.c
@@ -79,7 +79,7 @@ setup (Test *test, gconstpointer unused)
        module = gck_module_new (&test->funcs);
        modules = g_list_prepend (modules, module);
        gcr_pkcs11_set_modules (modules);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        bytes = g_bytes_new_static (test->cert_data, test->n_cert_data);
        asn = egg_asn1x_create_and_decode (pkix_asn1_tab, "Certificate", bytes);
diff --git a/gcr/test-trust.c b/gcr/test-trust.c
index fb3dca9..6103481 100644
--- a/gcr/test-trust.c
+++ b/gcr/test-trust.c
@@ -71,7 +71,7 @@ setup (Test *test, gconstpointer unused)
        module = gck_module_new (&test->funcs);
        modules = g_list_prepend (modules, module);
        gcr_pkcs11_set_modules (modules);
-       gck_list_unref_free (modules);
+       g_list_free_full (modules, g_object_unref);
 
        uris[0] = GCK_MOCK_SLOT_ONE_URI;
        uris[1] = NULL;
diff --git a/ui/gcr-import-button.c b/ui/gcr-import-button.c
index 56de3e7..b1a2885 100644
--- a/ui/gcr-import-button.c
+++ b/ui/gcr-import-button.c
@@ -267,8 +267,7 @@ gcr_import_button_dispose (GObject *obj)
 {
        GcrImportButton *self = GCR_IMPORT_BUTTON (obj);
 
-       gck_list_unref_free (self->pv->importers);
-       self->pv->importers = NULL;
+       g_clear_list (&self->pv->importers, g_object_unref);
        g_cancellable_cancel (self->pv->cancellable);
        g_clear_object (&self->pv->menu);
 
@@ -303,8 +302,7 @@ on_import_complete (GObject *importer,
        gcr_importer_import_finish (GCR_IMPORTER (importer), result, &error);
        if (error == NULL) {
                g_object_get (importer, "label", &self->pv->imported, NULL);
-               gck_list_unref_free (self->pv->importers);
-               self->pv->importers = NULL;
+               g_clear_list (&self->pv->importers, g_object_unref);
        }
 
        g_signal_emit (self, signals[IMPORTED], 0, importer, error);
@@ -591,7 +589,7 @@ gcr_import_button_add_parsed (GcrImportButton *self,
                self->pv->created = TRUE;
        }
 
-       gck_list_unref_free (self->pv->importers);
+       g_list_free_full (self->pv->importers, g_object_unref);
        self->pv->importers = importers;
 
        update_import_button (self);


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