[glib: 2/9] glib/gtestutils: Introduce and use a g_test_case_free function




commit f0c0d8b67ce7cd089f50fb6660eedb4814951d96
Author: GOUJON Évan <goujon evan gmail com>
Date:   Fri Jul 23 22:10:08 2021 +0200

    glib/gtestutils: Introduce and use a g_test_case_free function

 docs/reference/glib/glib-sections.txt |  1 +
 glib/gtestutils.c                     | 15 +++++++++++++++
 glib/gtestutils.h                     |  3 +++
 3 files changed, 19 insertions(+)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 9c45e5e4b..b087fe050 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -3638,6 +3638,7 @@ g_test_get_root
 g_test_suite_add
 g_test_suite_add_suite
 g_test_run_suite
+g_test_case_free
 
 <SUBSECTION Private>
 g_test_trap_assertions
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 8ae746c73..ce53a8047 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -2994,6 +2994,21 @@ g_test_run_suite (GTestSuite *suite)
   return n_bad;
 }
 
+/**
+ * g_test_case_free:
+ * @test_case: a #GTestCase
+ *
+ * Free the @test_case.
+ *
+ * Since: 2.70
+ */
+void
+g_test_case_free (GTestCase *test_case)
+{
+  g_free (test_case->name);
+  g_slice_free (GTestCase, test_case);
+}
+
 static void
 gtest_default_log_handler (const gchar    *log_domain,
                            GLogLevelFlags  log_level,
diff --git a/glib/gtestutils.h b/glib/gtestutils.h
index 041143936..2376761d8 100644
--- a/glib/gtestutils.h
+++ b/glib/gtestutils.h
@@ -506,6 +506,9 @@ void          g_test_suite_add_suite    (GTestSuite     *suite,
 GLIB_AVAILABLE_IN_ALL
 int           g_test_run_suite          (GTestSuite     *suite);
 
+GLIB_AVAILABLE_IN_2_70
+void          g_test_case_free          (GTestCase *test_case);
+
 GLIB_AVAILABLE_IN_ALL
 void    g_test_trap_assertions          (const char     *domain,
                                          const char     *file,


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