[ostree] core: Remove ot_clear_checksum() in favor of g_clear_pointer()



commit 57fcafd1ab5d43796767e174f04d7b433fd9d7d2
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 17 08:08:57 2012 -0400

    core: Remove ot_clear_checksum() in favor of g_clear_pointer()

 src/libostree/ostree-core.c  |    2 +-
 src/libostree/ostree-repo.c  |    2 +-
 src/libotutil/ot-gio-utils.c |    2 +-
 src/libotutil/otutil.h       |    8 --------
 4 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index ce860e5..96673f4 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -563,7 +563,7 @@ ostree_checksum_file_from_input (GFileInfo        *file_info,
   ret = TRUE;
   ot_transfer_out_value (out_csum, &ret_csum);
  out:
-  ot_clear_checksum (&checksum);
+  g_clear_pointer (&checksum, (GDestroyNotify)g_checksum_free);
   return ret;
 }
 
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index e95b9dd..db24820 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1056,7 +1056,7 @@ stage_object_internal (OstreeRepo         *self,
     (void) unlink (ot_gfile_get_path_cached (temp_file));
   if (raw_temp_file)
     (void) unlink (ot_gfile_get_path_cached (raw_temp_file));
-  ot_clear_checksum (&checksum);
+  g_clear_pointer (&checksum, (GDestroyNotify) g_checksum_free);
   return ret;
 }
 
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index 5e93157..b3df9a0 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -336,7 +336,7 @@ ot_gio_splice_get_checksum (GOutputStream  *out,
   ret = TRUE;
   ot_transfer_out_value (out_csum, &ret_csum);
  out:
-  ot_clear_checksum (&checksum);
+  g_clear_pointer (&checksum, (GDestroyNotify) g_checksum_free);
   return ret;
 }
 
diff --git a/src/libotutil/otutil.h b/src/libotutil/otutil.h
index dfae5dc..e6b2fb3 100644
--- a/src/libotutil/otutil.h
+++ b/src/libotutil/otutil.h
@@ -26,14 +26,6 @@
 #include <gio/gio.h>
 
 #define ot_gobject_refz(o) (o ? g_object_ref (o) : o)
-#define ot_clear_checksum(c) G_STMT_START {     \
-  typeof(c) __tmp_chksum = c;                   \
-  if (__tmp_chksum)                             \
-    {                                           \
-      g_checksum_free (*__tmp_chksum);          \
-      *__tmp_chksum = NULL;                     \
-    }                                           \
-  } G_STMT_END;
 
 #define ot_transfer_out_value(outp, srcp) G_STMT_START {   \
   if (outp)                                                \



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