From 0e10479f85c37f2e70892605d520097c7aec225a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 22 Aug 2018 11:15:08 +0100 Subject: [PATCH] glib: Drop G_GNUC_MALLOC usage from various other allocation functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions may be OK to leave the G_GNUC_MALLOC attribute on, because the only valid pointers in the storage areas they return are, themselves, new pointers. However, it’s a lot easier to remove the attributes now than to try and diagnose miscompilations in future. The performance impact of this is likely to be unmeasurable. If there are performance problems caused by this, then they can be profiled and fixed case-by-case in future, bearing in mind the possibility for miscompilation if G_GNUC_MALLOC is readded. Signed-off-by: Philip Withnall https://gitlab.gnome.org/GNOME/glib/issues/1465 --- glib/gbookmarkfile.h | 6 +++--- glib/gconvert.h | 2 +- glib/gkeyfile.h | 8 ++++---- glib/gmappedfile.h | 4 ++-- glib/gstrfuncs.h | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/glib/gbookmarkfile.h b/glib/gbookmarkfile.h index b87d27e08..8dd93a1dc 100644 --- a/glib/gbookmarkfile.h +++ b/glib/gbookmarkfile.h @@ -146,7 +146,7 @@ GLIB_AVAILABLE_IN_ALL gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark, const gchar *uri, gsize *length, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL void g_bookmark_file_add_application (GBookmarkFile *bookmark, const gchar *uri, @@ -161,7 +161,7 @@ GLIB_AVAILABLE_IN_ALL gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark, const gchar *uri, gsize *length, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, const gchar *uri, @@ -228,7 +228,7 @@ GLIB_AVAILABLE_IN_ALL gint g_bookmark_file_get_size (GBookmarkFile *bookmark); GLIB_AVAILABLE_IN_ALL gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark, - gsize *length) G_GNUC_MALLOC; + gsize *length); GLIB_AVAILABLE_IN_ALL gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark, const gchar *uri, diff --git a/glib/gconvert.h b/glib/gconvert.h index d0d372150..132f7bb53 100644 --- a/glib/gconvert.h +++ b/glib/gconvert.h @@ -170,7 +170,7 @@ GLIB_AVAILABLE_IN_ALL gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL -gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC; +gchar **g_uri_list_extract_uris (const gchar *uri_list); G_END_DECLS diff --git a/glib/gkeyfile.h b/glib/gkeyfile.h index 78495518d..7a1004841 100644 --- a/glib/gkeyfile.h +++ b/glib/gkeyfile.h @@ -106,12 +106,12 @@ GLIB_AVAILABLE_IN_ALL gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_groups (GKeyFile *key_file, - gsize *length) G_GNUC_MALLOC; + gsize *length); GLIB_AVAILABLE_IN_ALL gchar **g_key_file_get_keys (GKeyFile *key_file, const gchar *group_name, gsize *length, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL gboolean g_key_file_has_group (GKeyFile *key_file, const gchar *group_name); @@ -212,7 +212,7 @@ gchar **g_key_file_get_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_string_list (GKeyFile *key_file, const gchar *group_name, @@ -225,7 +225,7 @@ gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, const gchar *key, const gchar *locale, gsize *length, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL void g_key_file_set_locale_string_list (GKeyFile *key_file, const gchar *group_name, diff --git a/glib/gmappedfile.h b/glib/gmappedfile.h index 1a06f7c56..8256811e6 100644 --- a/glib/gmappedfile.h +++ b/glib/gmappedfile.h @@ -34,11 +34,11 @@ typedef struct _GMappedFile GMappedFile; GLIB_AVAILABLE_IN_ALL GMappedFile *g_mapped_file_new (const gchar *filename, gboolean writable, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL GMappedFile *g_mapped_file_new_from_fd (gint fd, gboolean writable, - GError **error) G_GNUC_MALLOC; + GError **error); GLIB_AVAILABLE_IN_ALL gsize g_mapped_file_get_length (GMappedFile *file); GLIB_AVAILABLE_IN_ALL diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index b8790fc78..6b6ce52f9 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -270,18 +270,18 @@ typedef gchar** GStrv; GLIB_AVAILABLE_IN_ALL gchar** g_strsplit (const gchar *string, const gchar *delimiter, - gint max_tokens) G_GNUC_MALLOC; + gint max_tokens); GLIB_AVAILABLE_IN_ALL gchar ** g_strsplit_set (const gchar *string, const gchar *delimiters, - gint max_tokens) G_GNUC_MALLOC; + gint max_tokens); GLIB_AVAILABLE_IN_ALL gchar* g_strjoinv (const gchar *separator, gchar **str_array) G_GNUC_MALLOC; GLIB_AVAILABLE_IN_ALL void g_strfreev (gchar **str_array); GLIB_AVAILABLE_IN_ALL -gchar** g_strdupv (gchar **str_array) G_GNUC_MALLOC; +gchar** g_strdupv (gchar **str_array); GLIB_AVAILABLE_IN_ALL guint g_strv_length (gchar **str_array);