+2004-11-28 Matthias Clasen <mclasen@redhat.com>
+
+ * 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 <tml@iki.fi>
* glib/gutils.[hc]
+2004-11-28 Matthias Clasen <mclasen@redhat.com>
+
+ * 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 <tml@iki.fi>
* glib/gutils.[hc]
+2004-11-28 Matthias Clasen <mclasen@redhat.com>
+
+ * 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 <tml@iki.fi>
* glib/gutils.[hc]
+2004-11-28 Matthias Clasen <mclasen@redhat.com>
+
+ * 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 <tml@iki.fi>
* glib/gutils.[hc]
+2004-11-28 Matthias Clasen <mclasen@redhat.com>
+
+ * 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 <tml@iki.fi>
* glib/gutils.[hc]
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,
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.
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.
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
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,
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,
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,
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,
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,
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,
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,
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,
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,
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
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
#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
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
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
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
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
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
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
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
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
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
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
__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 )
#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)
/* 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);
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
/* 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
* 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
*/
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,
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.
*/
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
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,
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);
/* 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);