diff --git a/ChangeLog b/ChangeLog index 35e3c7944..60d55351d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ documents (should fix #1705374). * src/symbols.c: Sort symbol list tags also by line number (fixes #1703575). + * src/utils.c, src/utils.h: + Add G_GNUC_NULL_TERMINATED to ensure variable arglists are NULL + terminated (for GLib >= 2.8). 2007-04-21 Nick Treleaven diff --git a/src/utils.c b/src/utils.c index 1cb888eec..411c6baff 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1496,7 +1496,7 @@ gchar *utils_get_whitespace(gint a, gboolean alternative) } -/* frees all passed pointers if they are non-NULL, the first argument is nothing special, +/* Frees all passed pointers if they are non-NULL, the first argument is nothing special, * it will also be freed, the list should be ended with NULL */ void utils_free_pointers(gpointer first, ...) { @@ -1515,10 +1515,10 @@ void utils_free_pointers(gpointer first, ...) } -/* creates a string array deep copy of a series of non-NULL strings. - * the first argument is nothing special. - * the list must be ended with NULL. - * if first is NULL, NULL is returned. */ +/* Creates a string array deep copy of a series of non-NULL strings. + * The first argument is nothing special. + * The list must be ended with NULL. + * If first is NULL, NULL is returned. */ gchar **utils_strv_new(gchar *first, ...) { gsize strvlen, i; diff --git a/src/utils.h b/src/utils.h index 141ee5e0f..5f9de7f44 100644 --- a/src/utils.h +++ b/src/utils.h @@ -152,15 +152,20 @@ gchar *utils_get_utf8_from_locale(const gchar *locale_text); * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */ gchar *utils_get_whitespace(gint amount, gboolean alternative); -/* frees all passed pointers if they are non-NULL, the first argument is nothing special, - * it will also be freed, the list should be ended with NULL */ -void utils_free_pointers(gpointer first, ...); -/* creates a string array deep copy of a series of non-NULL strings. - * the first argument is nothing special. - * the list must be ended with NULL. - * if first is NULL, NULL is returned. */ -gchar **utils_strv_new(gchar *first, ...); +#if ! GLIB_CHECK_VERSION(2, 8, 0) +#define G_GNUC_NULL_TERMINATED +#endif + +/* Frees all passed pointers if they are non-NULL, the first argument is nothing special, + * it will also be freed, the list should be ended with NULL */ +void utils_free_pointers(gpointer first, ...) G_GNUC_NULL_TERMINATED; + +/* Creates a string array deep copy of a series of non-NULL strings. + * The first argument is nothing special. + * The list must be ended with NULL. + * If first is NULL, NULL is returned. */ +gchar **utils_strv_new(gchar *first, ...) G_GNUC_NULL_TERMINATED; gint utils_mkdir(const gchar *path, gboolean create_parent_dirs);