Add G_GNUC_NULL_TERMINATED to ensure variable arglists are NULL

terminated (for GLib >= 2.8).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1475 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2007-04-23 15:52:44 +00:00
parent 3ffa0a2545
commit 6ebf6aa2f5
3 changed files with 21 additions and 13 deletions

View File

@ -5,6 +5,9 @@
documents (should fix #1705374). documents (should fix #1705374).
* src/symbols.c: * src/symbols.c:
Sort symbol list tags also by line number (fixes #1703575). 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 <nick.treleaven@btinternet.com> 2007-04-21 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -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 */ * it will also be freed, the list should be ended with NULL */
void utils_free_pointers(gpointer first, ...) 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. /* Creates a string array deep copy of a series of non-NULL strings.
* the first argument is nothing special. * The first argument is nothing special.
* the list must be ended with NULL. * The list must be ended with NULL.
* if first is NULL, NULL is returned. */ * If first is NULL, NULL is returned. */
gchar **utils_strv_new(gchar *first, ...) gchar **utils_strv_new(gchar *first, ...)
{ {
gsize strvlen, i; gsize strvlen, i;

View File

@ -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. */ * If alternative is set to TRUE, it returns the opposite of app->pref_editor_use_tabs. */
gchar *utils_get_whitespace(gint amount, gboolean alternative); 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. #if ! GLIB_CHECK_VERSION(2, 8, 0)
* the first argument is nothing special. #define G_GNUC_NULL_TERMINATED
* the list must be ended with NULL. #endif
* if first is NULL, NULL is returned. */
gchar **utils_strv_new(gchar *first, ...); /* 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); gint utils_mkdir(const gchar *path, gboolean create_parent_dirs);