[glib] glib/*: Use g_slist_free_full() convenience function
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] glib/*: Use g_slist_free_full() convenience function
- Date: Thu, 5 Jan 2012 03:58:22 +0000 (UTC)
commit e3d53d5529522a8db4e1711b47baa44250ce09fd
Author: Javier JardÃn <jjardon gnome org>
Date: Thu Jan 5 04:31:21 2012 +0100
glib/*: Use g_slist_free_full() convenience function
glib/gshell.c | 14 ++++----------
glib/tests/regex.c | 3 +--
2 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/glib/gshell.c b/glib/gshell.c
index 315f502..205519e 100644
--- a/glib/gshell.c
+++ b/glib/gshell.c
@@ -587,12 +587,8 @@ tokenize_command_line (const gchar *command_line,
error:
g_assert (error == NULL || *error != NULL);
-
- if (retval)
- {
- g_slist_foreach (retval, (GFunc)g_free, NULL);
- g_slist_free (retval);
- }
+
+ g_slist_free_full (retval, g_free);
return NULL;
}
@@ -667,8 +663,7 @@ g_shell_parse_argv (const gchar *command_line,
++i;
}
- g_slist_foreach (tokens, (GFunc)g_free, NULL);
- g_slist_free (tokens);
+ g_slist_free_full (tokens, g_free);
if (argcp)
*argcp = argc;
@@ -684,8 +679,7 @@ g_shell_parse_argv (const gchar *command_line,
g_assert (error == NULL || *error != NULL);
g_strfreev (argv);
- g_slist_foreach (tokens, (GFunc) g_free, NULL);
- g_slist_free (tokens);
+ g_slist_free_full (tokens, g_free);
return FALSE;
}
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index 6afa194..b256cb4 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -268,8 +268,7 @@ test_match_next (gconstpointer d)
}
g_regex_unref (regex);
- g_slist_foreach (matches, free_match, NULL);
- g_slist_free (matches);
+ g_slist_free_full (matches, free_match);
}
#define TEST_MATCH_NEXT0(_pattern, _string, _string_len, _start_position) { \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]