[gtksourceview/master-msvc: 4/4] tests/testsuite: Avoid g_auto*




commit db4efe0343d3210ef7ddfca714bdbee629f58c89
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Oct 22 11:08:45 2021 +0800

    tests/testsuite: Avoid g_auto*
    
    This way, things will continue to build on Visual Studio.

 tests/test-load.c      | 18 ++++++++++++------
 testsuite/test-regex.c |  3 ++-
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/tests/test-load.c b/tests/test-load.c
index 033ec274..2fe040c2 100644
--- a/tests/test-load.c
+++ b/tests/test-load.c
@@ -6,12 +6,13 @@ finished_cb (GObject      *object,
              GAsyncResult *result,
              gpointer      user_data)
 {
-  g_autoptr(GError) error = NULL;
+  GError *error = NULL;
   GMainLoop *loop = user_data;
 
   if (!gtk_source_file_loader_load_finish (GTK_SOURCE_FILE_LOADER (object), result, &error))
     g_printerr ("Error loading file: %s\n", error->message);
 
+  g_clear_error (&error);
   g_main_loop_quit (loop);
 }
 
@@ -19,11 +20,11 @@ int
 main (int argc,
       char *argv[])
 {
-  g_autoptr(GFile) file = NULL;
-  g_autoptr(GMainLoop) loop = NULL;
-  g_autoptr(GtkSourceBuffer) buffer = NULL;
-  g_autoptr(GtkSourceFile) sfile = NULL;
-  g_autoptr(GtkSourceFileLoader) loader = NULL;
+  GFile *file = NULL;
+  GMainLoop *loop = NULL;
+  GtkSourceBuffer *buffer = NULL;
+  GtkSourceFile *sfile = NULL;
+  GtkSourceFileLoader *loader = NULL;
 
   if (argc != 2)
     {
@@ -44,5 +45,10 @@ main (int argc,
 
   g_main_loop_run (loop);
 
+  g_object_unref (loader);
+  g_object_unref (sfile);
+  g_object_unref (buffer);
+  g_object_unref (file);
+  g_main_loop_unref (loop);
   return EXIT_SUCCESS;
 }
diff --git a/testsuite/test-regex.c b/testsuite/test-regex.c
index 55a3e8b0..c1add0e9 100644
--- a/testsuite/test-regex.c
+++ b/testsuite/test-regex.c
@@ -217,7 +217,7 @@ test_issue_198 (void)
   GError *error = NULL;
   ImplRegex *re = impl_regex_new ("(a)*", 0, 0, &error);
   ImplMatchInfo *mi = NULL;
-  g_autofree char *aaa = g_malloc (8192);
+  char *aaa = g_malloc (8192);
   gboolean r;
 
   g_assert_no_error (error);
@@ -230,6 +230,7 @@ test_issue_198 (void)
   g_assert_nonnull (mi);
   g_assert_true (r);
 
+  g_free (aaa);
   g_clear_pointer (&mi, impl_match_info_free);
   g_clear_pointer (&re, impl_regex_unref);
 }


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