Merge branch 'gdate-copy-fixes' into 'master'

gdate: Add autoptr support

See merge request GNOME/glib!1256
This commit is contained in:
Philip Withnall 2019-12-11 11:02:42 +00:00
commit 8f5d2c370d
3 changed files with 11 additions and 1 deletions

View File

@ -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(GBytes, g_bytes_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) 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(GDir, g_dir_close)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)

View File

@ -69,6 +69,13 @@ test_g_checksum (void)
g_assert_nonnull (val); g_assert_nonnull (val);
} }
static void
test_g_date (void)
{
g_autoptr(GDate) val = g_date_new ();
g_assert_nonnull (val);
}
static void static void
test_g_date_time (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_bookmark_file", test_g_bookmark_file);
g_test_add_func ("/autoptr/g_bytes", test_g_bytes); 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_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_date_time", test_g_date_time);
g_test_add_func ("/autoptr/g_dir", test_g_dir); g_test_add_func ("/autoptr/g_dir", test_g_dir);
g_test_add_func ("/autoptr/g_error", test_g_error); g_test_add_func ("/autoptr/g_error", test_g_error);

View File

@ -8,6 +8,7 @@
#include "glib.h" #include "glib.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include <time.h> #include <time.h>
@ -506,7 +507,7 @@ g_print ("testing %d years\n", n_check_years);
g_print("\n%u tests passed, %u failed\n",passed, notpassed); g_print("\n%u tests passed, %u failed\n",passed, notpassed);
return 0; return (notpassed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
} }