[glib: 1/3] glib-autocleanups: Define the cleanup function for GDate



commit c08d58d778138fc07ffab4bc1d59c8d3d5e43abb
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Nov 27 17:07:06 2019 +0100

    glib-autocleanups: Define the cleanup function for GDate
    
    Add an autoptr test as well.

 glib/glib-autocleanups.h | 1 +
 glib/tests/autoptr.c     | 8 ++++++++
 2 files changed, 9 insertions(+)
---
diff --git a/glib/glib-autocleanups.h b/glib/glib-autocleanups.h
index b71101f2d..acd38a7ab 100644
--- a/glib/glib-autocleanups.h
+++ b/glib/glib-autocleanups.h
@@ -47,6 +47,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
diff --git a/glib/tests/autoptr.c b/glib/tests/autoptr.c
index 14b95a9cc..788d05c5e 100644
--- a/glib/tests/autoptr.c
+++ b/glib/tests/autoptr.c
@@ -69,6 +69,13 @@ test_g_checksum (void)
   g_assert_nonnull (val);
 }
 
+static void
+test_g_date (void)
+{
+  g_autoptr(GDate) val = g_date_new ();
+  g_assert_nonnull (val);
+}
+
 static void
 test_g_date_time (void)
 {
@@ -704,6 +711,7 @@ main (int argc, gchar *argv[])
   g_test_add_func ("/autoptr/g_bookmark_file", test_g_bookmark_file);
   g_test_add_func ("/autoptr/g_bytes", test_g_bytes);
   g_test_add_func ("/autoptr/g_checksum", test_g_checksum);
+  g_test_add_func ("/autoptr/g_date", test_g_date);
   g_test_add_func ("/autoptr/g_date_time", test_g_date_time);
   g_test_add_func ("/autoptr/g_dir", test_g_dir);
   g_test_add_func ("/autoptr/g_error", test_g_error);


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