[gtk/wip/otte/for-master: 9/10] stringlist: Call splice() for adding items after construction



commit f6c2c2edbd3fc86fa5d6e6c31a10084de4d46df7
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jun 30 23:31:02 2020 +0200

    stringlist: Call splice() for adding items after construction
    
    This has the benefit of actually allowing NULL to be passed.

 gtk/gtkstringlist.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gtk/gtkstringlist.c b/gtk/gtkstringlist.c
index a3e2af5f68..608081d500 100644
--- a/gtk/gtkstringlist.c
+++ b/gtk/gtkstringlist.c
@@ -434,12 +434,10 @@ GtkStringList *
 gtk_string_list_new (const char * const *strings)
 {
   GtkStringList *self;
-  guint i;
 
   self = g_object_new (GTK_TYPE_STRING_LIST, NULL);
 
-  for (i = 0; strings[i]; i++)
-    g_sequence_append (self->items, gtk_string_object_new (strings[i]));
+  gtk_string_list_splice (self, 0, 0, strings);
 
   return self;
 }


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