[ostree] core: Drop ot_clear_hashtable for g_clear_pointer()



commit 0d86702115fa71d5140009072a1a20109fe92f63
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 17 08:18:43 2012 -0400

    core: Drop ot_clear_hashtable for g_clear_pointer()

 src/libotutil/ot-variant-utils.h |    6 ------
 src/ostree/ostree-pull.c         |    2 +-
 src/ostree/ot-builtin-fsck.c     |    2 +-
 3 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/src/libotutil/ot-variant-utils.h b/src/libotutil/ot-variant-utils.h
index ea238b4..1dec5c4 100644
--- a/src/libotutil/ot-variant-utils.h
+++ b/src/libotutil/ot-variant-utils.h
@@ -27,12 +27,6 @@
 
 G_BEGIN_DECLS
 
-#define ot_clear_hashtable(a_v) do { \
-  if (*a_v)                         \
-    g_hash_table_unref (*a_v);         \
-  *a_v = NULL;                      \
-  } while (0);
-
 GVariant *ot_gvariant_new_bytearray (const guchar   *data,
                                      gsize           len);
 
diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c
index dde4f0a..d1cc5ee 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/ostree/ostree-pull.c
@@ -1660,7 +1660,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
   g_free (pull_data->remote_name);
   if (pull_data->base_uri)
     soup_uri_free (pull_data->base_uri);
-  ot_clear_hashtable (&pull_data->file_checksums_to_fetch);
+  g_clear_pointer (&pull_data->file_checksums_to_fetch, (GDestroyNotify) g_hash_table_unref);
   g_clear_pointer (&pull_data->cached_meta_pack_indexes, (GDestroyNotify) g_ptr_array_unref);
   g_clear_pointer (&pull_data->cached_data_pack_indexes, (GDestroyNotify) g_ptr_array_unref);
   if (summary_uri)
diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c
index bfb78b9..1a00362 100644
--- a/src/ostree/ot-builtin-fsck.c
+++ b/src/ostree/ot-builtin-fsck.c
@@ -347,7 +347,7 @@ ostree_builtin_fsck (int argc, char **argv, GFile *repo_path, GError **error)
         g_hash_table_insert (commits, g_variant_ref (serialized_key), serialized_key);
     }
 
-  ot_clear_hashtable (&objects);
+  g_clear_pointer (&objects, (GDestroyNotify) g_hash_table_unref);
 
   g_print ("Verifying content integrity of %u commit objects...\n",
            (guint)g_hash_table_size (commits));



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