From: Matthias Clasen Date: Sun, 28 Nov 2004 19:12:04 +0000 (+0000) Subject: Mark functions with G_GNUC_MALLOC when appropriate. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=379e87466d0896050e2dec1db5fc1c71393b08a1;p=dana%2Fcg-glib.git Mark functions with G_GNUC_MALLOC when appropriate. 2004-11-28 Matthias Clasen * glib/gconvert.h: * glib/gkeyfile.h: * glib/gmem.h: * glib/gstrfuncs.h: * glib/gunicode.h: * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. * glib/glib.symbols: Add G_GNUC_MALLOC annotations. * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for __attribute__((__malloc__)). (#61780) --- diff --git a/ChangeLog b/ChangeLog index 52fc1807..4ad2d3eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-11-28 Matthias Clasen + + * glib/gconvert.h: + * glib/gkeyfile.h: + * glib/gmem.h: + * glib/gstrfuncs.h: + * glib/gunicode.h: + * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. + + * glib/glib.symbols: Add G_GNUC_MALLOC annotations. + + * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for + __attribute__((__malloc__)). (#61780) + 2004-11-28 Tor Lillqvist * glib/gutils.[hc] diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 52fc1807..4ad2d3eb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +2004-11-28 Matthias Clasen + + * glib/gconvert.h: + * glib/gkeyfile.h: + * glib/gmem.h: + * glib/gstrfuncs.h: + * glib/gunicode.h: + * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. + + * glib/glib.symbols: Add G_GNUC_MALLOC annotations. + + * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for + __attribute__((__malloc__)). (#61780) + 2004-11-28 Tor Lillqvist * glib/gutils.[hc] diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 52fc1807..4ad2d3eb 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,17 @@ +2004-11-28 Matthias Clasen + + * glib/gconvert.h: + * glib/gkeyfile.h: + * glib/gmem.h: + * glib/gstrfuncs.h: + * glib/gunicode.h: + * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. + + * glib/glib.symbols: Add G_GNUC_MALLOC annotations. + + * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for + __attribute__((__malloc__)). (#61780) + 2004-11-28 Tor Lillqvist * glib/gutils.[hc] diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 52fc1807..4ad2d3eb 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +2004-11-28 Matthias Clasen + + * glib/gconvert.h: + * glib/gkeyfile.h: + * glib/gmem.h: + * glib/gstrfuncs.h: + * glib/gunicode.h: + * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. + + * glib/glib.symbols: Add G_GNUC_MALLOC annotations. + + * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for + __attribute__((__malloc__)). (#61780) + 2004-11-28 Tor Lillqvist * glib/gutils.[hc] diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 52fc1807..4ad2d3eb 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +2004-11-28 Matthias Clasen + + * glib/gconvert.h: + * glib/gkeyfile.h: + * glib/gmem.h: + * glib/gstrfuncs.h: + * glib/gunicode.h: + * glib/gutils.h: Mark functions with G_GNUC_MALLOC when appropriate. + + * glib/glib.symbols: Add G_GNUC_MALLOC annotations. + + * glib/gmacros.h (G_GNUC_MALLOC): Add a macro for + __attribute__((__malloc__)). (#61780) + 2004-11-28 Tor Lillqvist * glib/gutils.[hc] diff --git a/glib/gconvert.h b/glib/gconvert.h index cc4f48bf..78838793 100644 --- a/glib/gconvert.h +++ b/glib/gconvert.h @@ -65,13 +65,13 @@ gchar* g_convert (const gchar *str, const gchar *from_codeset, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_convert_with_iconv (const gchar *str, gssize len, GIConv converter, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_convert_with_fallback (const gchar *str, gssize len, const gchar *to_codeset, @@ -79,7 +79,7 @@ gchar* g_convert_with_fallback (const gchar *str, gchar *fallback, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; /* Convert between libc's idea of strings and UTF-8. @@ -88,12 +88,12 @@ gchar* g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; /* Convert between the operating system (or C runtime) * representation of file names and UTF-8. @@ -107,24 +107,24 @@ gchar* g_filename_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, - GError **error); + GError **error) G_GNUC_MALLOC; gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, - GError **error); -gchar *g_filename_display_name (const gchar *filename); + GError **error) G_GNUC_MALLOC; +gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets); -gchar **g_uri_list_extract_uris (const gchar *uri_list); +gchar **g_uri_list_extract_uris (const gchar *uri_list) G_GNUC_MALLOC; G_END_DECLS diff --git a/glib/gkeyfile.h b/glib/gkeyfile.h index 8c9f4f73..08c0fe55 100644 --- a/glib/gkeyfile.h +++ b/glib/gkeyfile.h @@ -70,14 +70,14 @@ gboolean g_key_file_load_from_data_dirs (GKeyFile *key_file, GError **error); gchar *g_key_file_to_data (GKeyFile *key_file, gsize *length, - GError **error); -gchar *g_key_file_get_start_group (GKeyFile *key_file); + GError **error) G_GNUC_MALLOC; +gchar *g_key_file_get_start_group (GKeyFile *key_file) G_GNUC_MALLOC; gchar **g_key_file_get_groups (GKeyFile *key_file, - gsize *length); + gsize *length) G_GNUC_MALLOC; gchar **g_key_file_get_keys (GKeyFile *key_file, const gchar *group_name, gsize *length, - GError **error); + GError **error) G_GNUC_MALLOC; gboolean g_key_file_has_group (GKeyFile *key_file, const gchar *group_name); gboolean g_key_file_has_key (GKeyFile *key_file, @@ -87,7 +87,7 @@ gboolean g_key_file_has_key (GKeyFile *key_file, gchar *g_key_file_get_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_value (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -95,7 +95,7 @@ void g_key_file_set_value (GKeyFile *key_file, gchar *g_key_file_get_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -104,7 +104,7 @@ gchar *g_key_file_get_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, const gchar *locale, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_locale_string (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -130,7 +130,7 @@ gchar **g_key_file_get_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -141,7 +141,7 @@ gchar **g_key_file_get_locale_string_list (GKeyFile *key_file, const gchar *key, const gchar *locale, gsize *length, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_locale_string_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -152,7 +152,7 @@ gboolean *g_key_file_get_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_boolean_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -162,7 +162,7 @@ gint *g_key_file_get_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, gsize *length, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_set_integer_list (GKeyFile *key_file, const gchar *group_name, const gchar *key, @@ -176,7 +176,7 @@ void g_key_file_set_comment (GKeyFile *key_file, gchar *g_key_file_get_comment (GKeyFile *key_file, const gchar *group_name, const gchar *key, - GError **error); + GError **error) G_GNUC_MALLOC; void g_key_file_remove_comment (GKeyFile *key_file, const gchar *group_name, diff --git a/glib/glib.symbols b/glib/glib.symbols index 6b804909..0c3eb93e 100644 --- a/glib/glib.symbols +++ b/glib/glib.symbols @@ -16,11 +16,11 @@ g_ascii_digit_value G_GNUC_CONST g_ascii_dtostr g_ascii_formatd g_ascii_strcasecmp -g_ascii_strdown +g_ascii_strdown G_GNUC_MALLOC g_ascii_strncasecmp g_ascii_strtod g_ascii_strtoull -g_ascii_strup +g_ascii_strup G_GNUC_MALLOC g_ascii_tolower G_GNUC_CONST g_ascii_toupper G_GNUC_CONST g_ascii_xdigit_value G_GNUC_CONST @@ -84,10 +84,10 @@ g_completion_free g_completion_new g_completion_remove_items g_completion_set_compare -g_convert +g_convert G_GNUC_MALLOC g_convert_error_quark -g_convert_with_fallback -g_convert_with_iconv +g_convert_with_fallback G_GNUC_MALLOC +g_convert_with_iconv G_GNUC_MALLOC g_datalist_clear g_datalist_foreach g_datalist_id_get_data @@ -168,14 +168,14 @@ g_file_get_contents PRIVATE #ifdef G_OS_WIN32 g_file_get_contents_utf8 #endif -g_filename_display_name -g_filename_from_uri -g_filename_from_utf8 PRIVATE +g_filename_display_name G_GNUC_MALLOC +g_filename_from_uri G_GNUC_MALLOC +g_filename_from_utf8 PRIVATE G_GNUC_MALLOC #ifdef G_OS_WIN32 g_filename_from_utf8_utf8 #endif -g_filename_to_uri -g_filename_to_utf8 PRIVATE +g_filename_to_uri G_GNUC_MALLOC +g_filename_to_utf8 PRIVATE G_GNUC_MALLOC #ifdef G_OS_WIN32 g_filename_to_utf8_utf8 #endif @@ -325,18 +325,18 @@ g_io_create_watch g_key_file_error_quark g_key_file_free g_key_file_get_boolean -g_key_file_get_boolean_list -g_key_file_get_comment -g_key_file_get_groups +g_key_file_get_boolean_list G_GNUC_MALLOC +g_key_file_get_comment G_GNUC_MALLOC +g_key_file_get_groups G_GNUC_MALLOC g_key_file_get_integer -g_key_file_get_integer_list -g_key_file_get_keys -g_key_file_get_locale_string -g_key_file_get_locale_string_list -g_key_file_get_start_group -g_key_file_get_string -g_key_file_get_string_list -g_key_file_get_value +g_key_file_get_integer_list G_GNUC_MALLOC +g_key_file_get_keys G_GNUC_MALLOC +g_key_file_get_locale_string G_GNUC_MALLOC +g_key_file_get_locale_string_list G_GNUC_MALLOC +g_key_file_get_start_group G_GNUC_MALLOC +g_key_file_get_string G_GNUC_MALLOC +g_key_file_get_string_list G_GNUC_MALLOC +g_key_file_get_value G_GNUC_MALLOC g_key_file_has_group g_key_file_has_key g_key_file_load_from_data @@ -357,7 +357,7 @@ g_key_file_set_locale_string_list g_key_file_set_string g_key_file_set_string_list g_key_file_set_value -g_key_file_to_data +g_key_file_to_data G_GNUC_MALLOC glib_check_version g_list_alloc g_list_append @@ -389,8 +389,8 @@ g_list_remove_link g_list_reverse g_list_sort g_list_sort_with_data -g_locale_from_utf8 -g_locale_to_utf8 +g_locale_from_utf8 G_GNUC_MALLOC +g_locale_to_utf8 G_GNUC_MALLOC g_log G_GNUC_PRINTF(3,4) g_log_default_handler g_log_remove_handler @@ -429,8 +429,8 @@ g_main_loop_quit g_main_loop_ref g_main_loop_run g_main_loop_unref -g_malloc -g_malloc0 +g_malloc G_GNUC_MALLOC +g_malloc0 G_GNUC_MALLOC g_markup_error_quark g_markup_escape_text g_markup_parse_context_end_parse @@ -450,7 +450,7 @@ g_mem_chunk_info g_mem_chunk_new g_mem_chunk_print g_mem_chunk_reset -g_memdup +g_memdup G_GNUC_MALLOC g_mem_is_system_malloc g_mem_profile g_mem_set_vtable @@ -512,8 +512,8 @@ g_option_group_set_parse_hooks g_option_group_set_translate_func g_option_group_set_translation_domain g_parse_debug_string -g_path_get_basename -g_path_get_dirname +g_path_get_basename G_GNUC_MALLOC +g_path_get_dirname G_GNUC_MALLOC g_path_is_absolute g_path_skip_root g_pattern_match @@ -727,17 +727,17 @@ g_strcanon g_strcasecmp g_strchomp g_strchug -g_strcompress -g_strconcat +g_strcompress G_GNUC_MALLOC +g_strconcat G_GNUC_MALLOC g_strdelimit g_strdown -g_strdup -g_strdup_printf G_GNUC_PRINTF(1,2) -g_strdupv -g_strdup_vprintf +g_strdup G_GNUC_MALLOC +g_strdup_printf G_GNUC_PRINTF(1,2) G_GNUC_MALLOC +g_strdupv G_GNUC_MALLOC +g_strdup_vprintf G_GNUC_MALLOC g_str_equal g_strerror G_GNUC_CONST -g_strescape +g_strescape G_GNUC_MALLOC g_strfreev g_str_hash g_str_has_prefix @@ -775,19 +775,19 @@ g_string_sized_new g_string_truncate g_string_up g_strip_context -g_strjoin -g_strjoinv +g_strjoin G_GNUC_MALLOC +g_strjoinv G_GNUC_MALLOC g_strlcat g_strlcpy g_strncasecmp -g_strndup -g_strnfill +g_strndup G_GNUC_MALLOC +g_strnfill G_GNUC_MALLOC g_strreverse g_strrstr g_strrstr_len g_strsignal G_GNUC_CONST -g_strsplit -g_strsplit_set +g_strsplit G_GNUC_MALLOC +g_strsplit_set G_GNUC_MALLOC g_strstr_len g_strtod g_strup @@ -835,12 +835,12 @@ g_tree_replace g_tree_search g_tree_steal g_tree_traverse -g_try_malloc +g_try_malloc G_GNUC_MALLOC g_try_realloc g_tuples_destroy g_tuples_index -g_ucs4_to_utf16 -g_ucs4_to_utf8 +g_ucs4_to_utf16 G_GNUC_MALLOC +g_ucs4_to_utf8 G_GNUC_MALLOC g_unichar_break_type G_GNUC_CONST g_unichar_digit_value G_GNUC_CONST g_unichar_get_mirror_char @@ -865,35 +865,35 @@ g_unichar_to_utf8 g_unichar_type G_GNUC_CONST g_unichar_validate g_unichar_xdigit_value G_GNUC_CONST -g_unicode_canonical_decomposition +g_unicode_canonical_decomposition G_GNUC_MALLOC g_unicode_canonical_ordering g_unlink g_unsetenv -g_uri_list_extract_uris +g_uri_list_extract_uris G_GNUC_MALLOC g_usleep -g_utf16_to_ucs4 -g_utf16_to_utf8 -g_utf8_casefold +g_utf16_to_ucs4 G_GNUC_MALLOC +g_utf16_to_utf8 G_GNUC_MALLOC +g_utf8_casefold G_GNUC_MALLOC g_utf8_collate -g_utf8_collate_key +g_utf8_collate_key G_GNUC_MALLOC g_utf8_find_next_char g_utf8_find_prev_char g_utf8_get_char g_utf8_get_char_validated -g_utf8_normalize +g_utf8_normalize G_GNUC_MALLOC g_utf8_offset_to_pointer g_utf8_pointer_to_offset g_utf8_prev_char g_utf8_strchr -g_utf8_strdown +g_utf8_strdown G_GNUC_MALLOC g_utf8_strlen g_utf8_strncpy g_utf8_strrchr g_utf8_strreverse -g_utf8_strup -g_utf8_to_ucs4 -g_utf8_to_ucs4_fast -g_utf8_to_utf16 +g_utf8_strup G_GNUC_MALLOC +g_utf8_to_ucs4 G_GNUC_MALLOC +g_utf8_to_ucs4_fast G_GNUC_MALLOC +g_utf8_to_utf16 G_GNUC_MALLOC g_utf8_validate g_vasprintf g_vfprintf diff --git a/glib/gmacros.h b/glib/gmacros.h index d205053f..6f642062 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -69,6 +69,8 @@ __attribute__((__unused__)) #define G_GNUC_NO_INSTRUMENT \ __attribute__((__no_instrument_function__)) +#define G_GNUC_MALLOC \ + __attribute__((__malloc__)) #else /* !__GNUC__ */ #define G_GNUC_PRINTF( format_idx, arg_idx ) #define G_GNUC_SCANF( format_idx, arg_idx ) @@ -77,6 +79,7 @@ #define G_GNUC_CONST #define G_GNUC_UNUSED #define G_GNUC_NO_INSTRUMENT +#define G_GNUC_MALLOC #endif /* !__GNUC__ */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) diff --git a/glib/gmem.h b/glib/gmem.h index 4071c0ad..a1cd3e73 100644 --- a/glib/gmem.h +++ b/glib/gmem.h @@ -45,12 +45,12 @@ typedef struct _GMemVTable GMemVTable; /* Memory allocation functions */ -gpointer g_malloc (gulong n_bytes); -gpointer g_malloc0 (gulong n_bytes); +gpointer g_malloc (gulong n_bytes) G_GNUC_MALLOC; +gpointer g_malloc0 (gulong n_bytes) G_GNUC_MALLOC; gpointer g_realloc (gpointer mem, gulong n_bytes); void g_free (gpointer mem); -gpointer g_try_malloc (gulong n_bytes); +gpointer g_try_malloc (gulong n_bytes) G_GNUC_MALLOC; gpointer g_try_realloc (gpointer mem, gulong n_bytes); diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index c5a75222..7319cd92 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -155,9 +155,9 @@ gint g_ascii_strncasecmp (const gchar *s1, const gchar *s2, gsize n); gchar* g_ascii_strdown (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; gchar* g_ascii_strup (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; #ifndef G_DISABLE_DEPRECATED @@ -179,24 +179,24 @@ gchar* g_strup (gchar *string); /* String utility functions that return a newly allocated string which * ought to be freed with g_free from the caller at some point. */ -gchar* g_strdup (const gchar *str); +gchar* g_strdup (const gchar *str) G_GNUC_MALLOC; gchar* g_strdup_printf (const gchar *format, - ...) G_GNUC_PRINTF (1, 2); + ...) G_GNUC_PRINTF (1, 2) G_GNUC_MALLOC; gchar* g_strdup_vprintf (const gchar *format, - va_list args); + va_list args) G_GNUC_MALLOC; gchar* g_strndup (const gchar *str, - gsize n); + gsize n) G_GNUC_MALLOC; gchar* g_strnfill (gsize length, - gchar fill_char); + gchar fill_char) G_GNUC_MALLOC; gchar* g_strconcat (const gchar *string1, - ...); /* NULL terminated */ + ...) G_GNUC_MALLOC; /* NULL terminated */ gchar* g_strjoin (const gchar *separator, - ...); /* NULL terminated */ + ...) G_GNUC_MALLOC; /* NULL terminated */ /* Make a copy of a string interpreting C string -style escape * sequences. Inverse of g_strescape. The recognized sequences are \b * \f \n \r \t \\ \" and the octal format. */ -gchar* g_strcompress (const gchar *source); +gchar* g_strcompress (const gchar *source) G_GNUC_MALLOC; /* Copy a string escaping nonprintable characters like in C strings. * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points @@ -207,10 +207,10 @@ gchar* g_strcompress (const gchar *source); * provides mostly identical semantics. */ gchar* g_strescape (const gchar *source, - const gchar *exceptions); + const gchar *exceptions) G_GNUC_MALLOC; gpointer g_memdup (gconstpointer mem, - guint byte_size); + guint byte_size) G_GNUC_MALLOC; /* NULL terminated string arrays. * g_strsplit(), g_strsplit_set() split up string into max_tokens tokens @@ -223,14 +223,14 @@ gpointer g_memdup (gconstpointer mem, */ gchar** g_strsplit (const gchar *string, const gchar *delimiter, - gint max_tokens); + gint max_tokens) G_GNUC_MALLOC; gchar ** g_strsplit_set (const gchar *string, const gchar *delimiters, - gint max_tokens); + gint max_tokens) G_GNUC_MALLOC; gchar* g_strjoinv (const gchar *separator, - gchar **str_array); + gchar **str_array) G_GNUC_MALLOC; void g_strfreev (gchar **str_array); -gchar** g_strdupv (gchar **str_array); +gchar** g_strdupv (gchar **str_array) G_GNUC_MALLOC; guint g_strv_length (gchar **str_array); gchar* g_stpcpy (gchar *dest, diff --git a/glib/gunicode.h b/glib/gunicode.h index 77d91294..4ed37a59 100644 --- a/glib/gunicode.h +++ b/glib/gunicode.h @@ -159,7 +159,7 @@ void g_unicode_canonical_ordering (gunichar *string, string of Unicode characters. RESULT_LEN is set to the resulting length of the string. */ gunichar *g_unicode_canonical_decomposition (gunichar ch, - gsize *result_len); + gsize *result_len) G_GNUC_MALLOC; /* Array of skip-bytes-per-initial character. */ @@ -204,35 +204,35 @@ gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; gunichar * g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; gunichar * g_utf8_to_ucs4_fast (const gchar *str, glong len, - glong *items_written); + glong *items_written) G_GNUC_MALLOC; gunichar * g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; gunichar2 *g_ucs4_to_utf16 (const gunichar *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; gchar* g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, - GError **error); + GError **error) G_GNUC_MALLOC; /* Convert a single character into UTF-8. outbuf must have at * least 6 bytes of space. Returns the number of bytes in the @@ -253,11 +253,11 @@ gboolean g_utf8_validate (const gchar *str, gboolean g_unichar_validate (gunichar ch); gchar *g_utf8_strup (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; gchar *g_utf8_strdown (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; gchar *g_utf8_casefold (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; typedef enum { G_NORMALIZE_DEFAULT, @@ -272,12 +272,12 @@ typedef enum { gchar *g_utf8_normalize (const gchar *str, gssize len, - GNormalizeMode mode); + GNormalizeMode mode) G_GNUC_MALLOC; gint g_utf8_collate (const gchar *str1, const gchar *str2); gchar *g_utf8_collate_key (const gchar *str, - gssize len); + gssize len) G_GNUC_MALLOC; gboolean g_unichar_get_mirror_char (gunichar ch, gunichar *mirrored_ch); diff --git a/glib/gutils.h b/glib/gutils.h index f939f1a1..6544c0f2 100644 --- a/glib/gutils.h +++ b/glib/gutils.h @@ -184,8 +184,8 @@ G_CONST_RETURN gchar* g_basename (const gchar *file_name); /* The returned strings are newly allocated with g_malloc() */ gchar* g_get_current_dir (void); -gchar* g_path_get_basename (const gchar *file_name); -gchar* g_path_get_dirname (const gchar *file_name); +gchar* g_path_get_basename (const gchar *file_name) G_GNUC_MALLOC; +gchar* g_path_get_dirname (const gchar *file_name) G_GNUC_MALLOC; /* Set the pointer at the specified location to NULL */ void g_nullify_pointer (gpointer *nullify_location);