diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2017-09-25 16:52:58 -0400 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2017-09-25 16:59:07 -0400 |
commit | 3ea0355e857b3f223b0e0be61fc2794c70f43aa2 (patch) | |
tree | d359cbba5bd43b9c17495c395406ce0640415f9a /panels/info/test-info-cleanup.c | |
parent | 999226832c99506abe74fabfb79edc07f6794cf9 (diff) | |
download | gnome-control-center-wip/rancell/info-g-auto.tar.gz |
info: Use g_auto for variableswip/rancell/info-g-auto
Diffstat (limited to 'panels/info/test-info-cleanup.c')
-rw-r--r-- | panels/info/test-info-cleanup.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/panels/info/test-info-cleanup.c b/panels/info/test-info-cleanup.c index 33ad91b88..3e6bebd2e 100644 --- a/panels/info/test-info-cleanup.c +++ b/panels/info/test-info-cleanup.c @@ -27,10 +27,9 @@ static void test_info (void) { - char *contents; - char *result; + g_autofree gchar *contents = NULL; guint i; - char **lines; + g_auto(GStrv) lines = NULL; if (g_file_get_contents (TEST_SRCDIR "/info-cleanup-test.txt", &contents, NULL, NULL) == FALSE) { g_warning ("Failed to load '%s'", TEST_SRCDIR "/info-cleanup-test.txt"); @@ -46,8 +45,9 @@ test_info (void) } for (i = 0; lines[i] != NULL; i++) { - char *utf8; - char **items; + g_auto(GStrv) items = NULL; + g_autofree gchar *utf8 = NULL; + g_autofree gchar *result = NULL; if (*lines[i] == '#') continue; @@ -65,14 +65,7 @@ test_info (void) g_debug ("Result for '%s' matches '%s'", utf8, result); } - g_free (result); - g_free (utf8); - - g_strfreev (items); } - - g_strfreev (lines); - g_free (contents); } int main (int argc, char **argv) |