[gedit] Allow NULL lists in gedit_settings_set_list
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Allow NULL lists in gedit_settings_set_list
- Date: Tue, 11 May 2010 21:56:47 +0000 (UTC)
commit 634f9789502484b6f46ff2a568bb4d2be22a7faa
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Tue May 11 23:55:41 2010 +0200
Allow NULL lists in gedit_settings_set_list
gedit/gedit-settings.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gedit/gedit-settings.c b/gedit/gedit-settings.c
index d7493ce..8ff1eb4 100644
--- a/gedit/gedit-settings.c
+++ b/gedit/gedit-settings.c
@@ -871,20 +871,24 @@ gedit_settings_set_list (GSettings *settings,
const gchar *key,
const GSList *list)
{
- gchar **values;
+ gchar **values = NULL;
const GSList *l;
- gint i, len;
+ gint len = 0;
g_return_if_fail (G_IS_SETTINGS (settings));
g_return_if_fail (key != NULL);
- g_return_if_fail (list != NULL);
-
- len = g_slist_length ((GSList *)list);
- values = g_new (gchar *, len);
- for (l = list, i = 0; l != NULL; l = g_slist_next (l), i++)
+ if (list != NULL)
{
- values[i] = l->data;
+ gint i;
+
+ len = g_slist_length ((GSList *)list);
+ values = g_new (gchar *, len);
+
+ for (l = list, i = 0; l != NULL; l = g_slist_next (l), i++)
+ {
+ values[i] = l->data;
+ }
}
g_settings_set_strv (settings, key, (const gchar * const *)values, len);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]