[goffice] go_slist_create: constify.



commit 0684476f83ba1878205d3ede0c4a19180cb655cc
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 12 11:19:17 2013 -0400

    go_slist_create: constify.

 ChangeLog                      |    4 ++++
 goffice/utils/go-glib-extras.c |    8 ++++----
 goffice/utils/go-glib-extras.h |    2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8636da2..be645a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-03-12  Morten Welinder  <terra gnome org>
+
+       * goffice/utils/go-glib-extras.c (go_slist_create): Constify.
+
 2013-03-10  Morten Welinder  <terra gnome org>
 
        * goffice/math/go-regression.c: Bring a blunt clue bat to the
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index b06e987..8cf84d8 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -85,22 +85,22 @@ go_ptr_array_insert (GPtrArray *array, gpointer value, int index)
 
 /**
  * go_slist_create:
- * @item1: optionally %NULL
- * @...: %NULL terminated list of additional items
+ * @item1: (allow-none) (transfer none): first item
+ * @...: (transfer none): %NULL terminated list of additional items
  *
  * Creates a GList from NULL-terminated list of arguments.
  * As the arguments are just copied to the list, the caller owns them.
  * Returns: (element-type void) (transfer container): created list.
  **/
 GSList *
-go_slist_create (gpointer item1, ...)
+go_slist_create (gconstpointer item1, ...)
 {
        va_list args;
        GSList *list = NULL;
        gpointer item;
 
        va_start (args, item1);
-       for (item = item1; item != NULL; item = va_arg (args, gpointer)) {
+       for (item = (gpointer)item1; item; item = va_arg (args, gpointer)) {
                list = g_slist_prepend (list, item);
        }
        va_end (args);
diff --git a/goffice/utils/go-glib-extras.h b/goffice/utils/go-glib-extras.h
index ada96c8..3a34b5a 100644
--- a/goffice/utils/go-glib-extras.h
+++ b/goffice/utils/go-glib-extras.h
@@ -14,7 +14,7 @@ void   go_ptr_array_insert    (GPtrArray *array, gpointer value, int index);
 GSList *go_hash_keys           (GHashTable *hash);
 
 GSList *go_slist_map           (GSList const *list, GOMapFunc map_func);
-GSList *go_slist_create        (gpointer item1, ...);
+GSList *go_slist_create        (gconstpointer item1, ...);
 #define         go_string_slist_copy(list) go_slist_map (list, (GOMapFunc) g_strdup)
 GSList *go_strsplit_to_slist   (char const *str, gchar delimiter);
 #define GO_SLIST_FOREACH(list,valtype,val,stmnt) \


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