diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-03-15 09:03:28 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2011-03-15 09:03:28 +0000 |
commit | 08f0a312895e0dd457f5f4d5bcdf282a6d5a793f (patch) | |
tree | c007d8a6024c8c1ee088b8a53caa5dac435cda2f | |
parent | 0c1acc7e741a01bf37d4c5f7a97ba1661f25d36a (diff) |
Revert "Remove all uses of G_CONST_RETURN"
This reverts commit 36741245cca56e979fe85e3de676fb3912058f2c.
The removal has not been discussed, except on Bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=644611
-rw-r--r-- | glib/gchecksum.c | 2 | ||||
-rw-r--r-- | glib/gchecksum.h | 2 | ||||
-rw-r--r-- | glib/gconvert.c | 4 | ||||
-rw-r--r-- | glib/gconvert.h | 2 | ||||
-rw-r--r-- | glib/gdataset.c | 6 | ||||
-rw-r--r-- | glib/gdir.c | 4 | ||||
-rw-r--r-- | glib/gdir.h | 2 | ||||
-rw-r--r-- | glib/giochannel.c | 4 | ||||
-rw-r--r-- | glib/giochannel.h | 4 | ||||
-rw-r--r-- | glib/glibintl.h | 6 | ||||
-rw-r--r-- | glib/gmain.c | 2 | ||||
-rw-r--r-- | glib/gmain.h | 2 | ||||
-rw-r--r-- | glib/gmarkup.c | 4 | ||||
-rw-r--r-- | glib/gmarkup.h | 4 | ||||
-rw-r--r-- | glib/goption.c | 4 | ||||
-rw-r--r-- | glib/goption.h | 4 | ||||
-rw-r--r-- | glib/gquark.h | 6 | ||||
-rw-r--r-- | glib/gstrfuncs.c | 16 | ||||
-rw-r--r-- | glib/gstrfuncs.h | 18 | ||||
-rw-r--r-- | glib/gunicode.h | 2 | ||||
-rw-r--r-- | glib/gutf8.c | 2 | ||||
-rw-r--r-- | glib/gutils.c | 56 | ||||
-rw-r--r-- | glib/gutils.h | 38 | ||||
-rw-r--r-- | gmodule/gmodule.c | 6 | ||||
-rw-r--r-- | gmodule/gmodule.h | 4 | ||||
-rw-r--r-- | gobject/gbinding.c | 4 | ||||
-rw-r--r-- | gobject/gbinding.h | 4 | ||||
-rw-r--r-- | gobject/gparam.c | 6 | ||||
-rw-r--r-- | gobject/gparam.h | 6 | ||||
-rw-r--r-- | gobject/gsignal.c | 2 | ||||
-rw-r--r-- | gobject/gsignal.h | 2 | ||||
-rw-r--r-- | gobject/gtype.c | 6 | ||||
-rw-r--r-- | gobject/gtype.h | 6 | ||||
-rw-r--r-- | gobject/gvaluetypes.c | 2 | ||||
-rw-r--r-- | gobject/gvaluetypes.h | 2 |
35 files changed, 122 insertions, 122 deletions
diff --git a/glib/gchecksum.c b/glib/gchecksum.c index 620def2bb..70531afe3 100644 --- a/glib/gchecksum.c +++ b/glib/gchecksum.c @@ -1289,7 +1289,7 @@ g_checksum_update (GChecksum *checksum, * * Since: 2.16 */ -const gchar * +G_CONST_RETURN gchar * g_checksum_get_string (GChecksum *checksum) { gchar *str = NULL; diff --git a/glib/gchecksum.h b/glib/gchecksum.h index 59bb31cd2..57aea103f 100644 --- a/glib/gchecksum.h +++ b/glib/gchecksum.h @@ -69,7 +69,7 @@ void g_checksum_free (GChecksum *checksum); void g_checksum_update (GChecksum *checksum, const guchar *data, gssize length); -const gchar * g_checksum_get_string (GChecksum *checksum); +G_CONST_RETURN gchar *g_checksum_get_string (GChecksum *checksum); void g_checksum_get_digest (GChecksum *checksum, guint8 *buffer, gsize *digest_len); diff --git a/glib/gconvert.c b/glib/gconvert.c index 5c26ddca4..b363bca3f 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -1318,7 +1318,7 @@ filename_charset_cache_free (gpointer data) * Since: 2.6 */ gboolean -g_get_filename_charsets (const gchar ***filename_charsets) +g_get_filename_charsets (G_CONST_RETURN gchar ***filename_charsets) { static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT; GFilenameCharsetCache *cache = g_static_private_get (&cache_private); @@ -1383,7 +1383,7 @@ g_get_filename_charsets (const gchar ***filename_charsets) #else /* G_PLATFORM_WIN32 */ gboolean -g_get_filename_charsets (const gchar ***filename_charsets) +g_get_filename_charsets (G_CONST_RETURN gchar ***filename_charsets) { static const gchar *charsets[] = { "UTF-8", diff --git a/glib/gconvert.h b/glib/gconvert.h index e433a577c..e4c20d77d 100644 --- a/glib/gconvert.h +++ b/glib/gconvert.h @@ -151,7 +151,7 @@ gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error) G_GNUC_MALLOC; gchar *g_filename_display_name (const gchar *filename) G_GNUC_MALLOC; -gboolean g_get_filename_charsets (const gchar ***charsets); +gboolean g_get_filename_charsets (G_CONST_RETURN gchar ***charsets); gchar *g_filename_display_basename (const gchar *filename) G_GNUC_MALLOC; diff --git a/glib/gdataset.c b/glib/gdataset.c index 2a8f399eb..ca92807f5 100644 --- a/glib/gdataset.c +++ b/glib/gdataset.c @@ -1129,7 +1129,7 @@ g_quark_from_static_string (const gchar *string) * * Gets the string associated with the given #GQuark. **/ -const gchar * +G_CONST_RETURN gchar* g_quark_to_string (GQuark quark) { gchar* result = NULL; @@ -1175,7 +1175,7 @@ g_quark_new (gchar *string) * * Since: 2.10 */ -const gchar * +G_CONST_RETURN gchar* g_intern_string (const gchar *string) { const gchar *result; @@ -1205,7 +1205,7 @@ g_intern_string (const gchar *string) * * Since: 2.10 */ -const gchar * +G_CONST_RETURN gchar* g_intern_static_string (const gchar *string) { GQuark quark; diff --git a/glib/gdir.c b/glib/gdir.c index 9919bbb14..0f0a17faf 100644 --- a/glib/gdir.c +++ b/glib/gdir.c @@ -194,7 +194,7 @@ g_dir_open (const gchar *path, * more entries. The return value is owned by GLib and * must not be modified or freed. **/ -const gchar * +G_CONST_RETURN gchar* g_dir_read_name (GDir *dir) { #ifdef G_OS_WIN32 @@ -250,7 +250,7 @@ g_dir_read_name (GDir *dir) /* Binary compatibility version. Not for newly compiled code. */ -const gchar * +G_CONST_RETURN gchar* g_dir_read_name (GDir *dir) { while (1) diff --git a/glib/gdir.h b/glib/gdir.h index 4344423e1..85e989695 100644 --- a/glib/gdir.h +++ b/glib/gdir.h @@ -43,7 +43,7 @@ typedef struct _GDir GDir; GDir * g_dir_open (const gchar *path, guint flags, GError **error); -const gchar * g_dir_read_name (GDir *dir); +G_CONST_RETURN gchar *g_dir_read_name (GDir *dir); void g_dir_rewind (GDir *dir); void g_dir_close (GDir *dir); diff --git a/glib/giochannel.c b/glib/giochannel.c index 7cfc19dd5..75808eb40 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -920,7 +920,7 @@ g_io_channel_set_line_term (GIOChannel *channel, * Return value: The line termination string. This value * is owned by GLib and must not be freed. **/ -const gchar * +G_CONST_RETURN gchar* g_io_channel_get_line_term (GIOChannel *channel, gint *length) { @@ -1458,7 +1458,7 @@ g_io_channel_set_encoding (GIOChannel *channel, * Return value: A string containing the encoding, this string is * owned by GLib and must not be freed. **/ -const gchar * +G_CONST_RETURN gchar* g_io_channel_get_encoding (GIOChannel *channel) { g_return_val_if_fail (channel != NULL, NULL); diff --git a/glib/giochannel.h b/glib/giochannel.h index ec6a7c0fd..0a427936e 100644 --- a/glib/giochannel.h +++ b/glib/giochannel.h @@ -215,7 +215,7 @@ GIOFlags g_io_channel_get_flags (GIOChannel *channel); void g_io_channel_set_line_term (GIOChannel *channel, const gchar *line_term, gint length); -const gchar * g_io_channel_get_line_term (GIOChannel *channel, +G_CONST_RETURN gchar* g_io_channel_get_line_term (GIOChannel *channel, gint *length); void g_io_channel_set_buffered (GIOChannel *channel, gboolean buffered); @@ -223,7 +223,7 @@ gboolean g_io_channel_get_buffered (GIOChannel *channel); GIOStatus g_io_channel_set_encoding (GIOChannel *channel, const gchar *encoding, GError **error); -const gchar * g_io_channel_get_encoding (GIOChannel *channel); +G_CONST_RETURN gchar* g_io_channel_get_encoding (GIOChannel *channel); void g_io_channel_set_close_on_unref (GIOChannel *channel, gboolean do_close); gboolean g_io_channel_get_close_on_unref (GIOChannel *channel); diff --git a/glib/glibintl.h b/glib/glibintl.h index 507e1c373..3164a0a89 100644 --- a/glib/glibintl.h +++ b/glib/glibintl.h @@ -5,9 +5,9 @@ #error "config.h must be included prior to glibintl.h" #endif -const gchar * glib_gettext (const gchar *str) G_GNUC_FORMAT(1); -const gchar * glib_pgettext (const gchar *msgctxtid, - gsize msgidoffset) G_GNUC_FORMAT(1); +G_CONST_RETURN gchar *glib_gettext (const gchar *str) G_GNUC_FORMAT(1); +G_CONST_RETURN gchar *glib_pgettext (const gchar *msgctxtid, + gsize msgidoffset) G_GNUC_FORMAT(1); #ifdef ENABLE_NLS diff --git a/glib/gmain.c b/glib/gmain.c index 020906f99..d4f393e73 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -1591,7 +1591,7 @@ g_source_set_name (GSource *source, * Return value: the name of the source * Since: 2.26 **/ -const char * +G_CONST_RETURN char* g_source_get_name (GSource *source) { g_return_val_if_fail (source != NULL, NULL); diff --git a/glib/gmain.h b/glib/gmain.h index 7dca04b4a..bd94651cc 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -350,7 +350,7 @@ gboolean g_source_is_destroyed (GSource *source); void g_source_set_name (GSource *source, const char *name); -const char * g_source_get_name (GSource *source); +G_CONST_RETURN char* g_source_get_name (GSource *source); void g_source_set_name_by_id (guint tag, const char *name); diff --git a/glib/gmarkup.c b/glib/gmarkup.c index 04ccfa388..609b88d80 100644 --- a/glib/gmarkup.c +++ b/glib/gmarkup.c @@ -1819,7 +1819,7 @@ g_markup_parse_context_end_parse (GMarkupParseContext *context, * * Since: 2.2 */ -const gchar * +G_CONST_RETURN gchar * g_markup_parse_context_get_element (GMarkupParseContext *context) { g_return_val_if_fail (context != NULL, NULL); @@ -1850,7 +1850,7 @@ g_markup_parse_context_get_element (GMarkupParseContext *context) * * Since: 2.16 */ -const GSList * +G_CONST_RETURN GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context) { g_return_val_if_fail (context != NULL, NULL); diff --git a/glib/gmarkup.h b/glib/gmarkup.h index a69f6e2a6..ab0190efe 100644 --- a/glib/gmarkup.h +++ b/glib/gmarkup.h @@ -194,8 +194,8 @@ gpointer g_markup_parse_context_pop (GMarkupParseContext *context) gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error); -const gchar * g_markup_parse_context_get_element (GMarkupParseContext *context); -const GSList * g_markup_parse_context_get_element_stack (GMarkupParseContext *context); +G_CONST_RETURN gchar *g_markup_parse_context_get_element (GMarkupParseContext *context); +G_CONST_RETURN GSList *g_markup_parse_context_get_element_stack (GMarkupParseContext *context); /* For user-constructed error messages, has no precise semantics */ void g_markup_parse_context_get_position (GMarkupParseContext *context, diff --git a/glib/goption.c b/glib/goption.c index 3a5640bc1..9a7adab11 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -2346,7 +2346,7 @@ g_option_context_set_summary (GOptionContext *context, * * Since: 2.12 */ -const gchar * +G_CONST_RETURN gchar * g_option_context_get_summary (GOptionContext *context) { g_return_val_if_fail (context != NULL, NULL); @@ -2390,7 +2390,7 @@ g_option_context_set_description (GOptionContext *context, * * Since: 2.12 */ -const gchar * +G_CONST_RETURN gchar * g_option_context_get_description (GOptionContext *context) { g_return_val_if_fail (context != NULL, NULL); diff --git a/glib/goption.h b/glib/goption.h index 340a84cff..557d8f713 100644 --- a/glib/goption.h +++ b/glib/goption.h @@ -310,10 +310,10 @@ struct _GOptionEntry GOptionContext *g_option_context_new (const gchar *parameter_string); void g_option_context_set_summary (GOptionContext *context, const gchar *summary); -const gchar * g_option_context_get_summary (GOptionContext *context); +G_CONST_RETURN gchar *g_option_context_get_summary (GOptionContext *context); void g_option_context_set_description (GOptionContext *context, const gchar *description); -const gchar * g_option_context_get_description (GOptionContext *context); +G_CONST_RETURN gchar *g_option_context_get_description (GOptionContext *context); void g_option_context_free (GOptionContext *context); void g_option_context_set_help_enabled (GOptionContext *context, gboolean help_enabled); diff --git a/glib/gquark.h b/glib/gquark.h index 324c95666..a0cbe2fd7 100644 --- a/glib/gquark.h +++ b/glib/gquark.h @@ -42,10 +42,10 @@ typedef guint32 GQuark; GQuark g_quark_try_string (const gchar *string); GQuark g_quark_from_static_string (const gchar *string); GQuark g_quark_from_string (const gchar *string); -const gchar * g_quark_to_string (GQuark quark) G_GNUC_CONST; +G_CONST_RETURN gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST; -const gchar * g_intern_string (const gchar *string); -const gchar * g_intern_static_string (const gchar *string); +G_CONST_RETURN gchar* g_intern_string (const gchar *string); +G_CONST_RETURN gchar* g_intern_static_string (const gchar *string); G_END_DECLS diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 7d8c1987b..04f686b40 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -933,7 +933,7 @@ g_ascii_strtoll (const gchar *nptr, * is unknown, it returns "unknown error (<code>)". The string * can only be used until the next call to g_strerror() */ -const gchar * +G_CONST_RETURN gchar* g_strerror (gint errnum) { static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; @@ -1414,7 +1414,7 @@ g_strerror (gint errnum) * it returns "unknown signal (<signum>)". The string can only be * used until the next call to g_strsignal() */ -const gchar * +G_CONST_RETURN gchar* g_strsignal (gint signum) { static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; @@ -2968,7 +2968,7 @@ g_str_has_prefix (const gchar *str, * * Since: 2.4 **/ -const gchar * +G_CONST_RETURN gchar * g_strip_context (const gchar *msgid, const gchar *msgval) { @@ -3034,7 +3034,7 @@ g_strv_length (gchar **str_array) * * Since: 2.16 */ -const gchar * +G_CONST_RETURN gchar * g_dpgettext (const gchar *domain, const gchar *msgctxtid, gsize msgidoffset) @@ -3095,7 +3095,7 @@ g_dpgettext (const gchar *domain, * * Since: 2.18 */ -const char * +G_CONST_RETURN char * g_dpgettext2 (const char *domain, const char *msgctxt, const char *msgid) @@ -3216,7 +3216,7 @@ _g_dgettext_should_translate (void) * * Since: 2.18 */ -const gchar * +G_CONST_RETURN gchar * g_dgettext (const gchar *domain, const gchar *msgid) { @@ -3242,7 +3242,7 @@ g_dgettext (const gchar *domain, * * Since: 2.26 */ -const gchar * +G_CONST_RETURN gchar * g_dcgettext (const gchar *domain, const gchar *msgid, int category) @@ -3272,7 +3272,7 @@ g_dcgettext (const gchar *domain, * * Since: 2.18 */ -const gchar * +G_CONST_RETURN gchar * g_dngettext (const gchar *domain, const gchar *msgid, const gchar *msgid_plural, diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h index 8f99c5597..5c7332a3c 100644 --- a/glib/gstrfuncs.h +++ b/glib/gstrfuncs.h @@ -103,9 +103,9 @@ gchar* g_strdelimit (gchar *string, gchar* g_strcanon (gchar *string, const gchar *valid_chars, gchar substitutor); -const gchar * g_strerror (gint errnum) G_GNUC_CONST; -const gchar * g_strsignal (gint signum) G_GNUC_CONST; -gchar * g_strreverse (gchar *string); +G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST; +G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST; +gchar* g_strreverse (gchar *string); gsize g_strlcpy (gchar *dest, const gchar *src, gsize dest_size); @@ -245,22 +245,22 @@ guint g_strv_length (gchar **str_array); gchar* g_stpcpy (gchar *dest, const char *src); -const gchar * g_strip_context (const gchar *msgid, +G_CONST_RETURN gchar *g_strip_context (const gchar *msgid, const gchar *msgval) G_GNUC_FORMAT(1); -const gchar * g_dgettext (const gchar *domain, +G_CONST_RETURN gchar *g_dgettext (const gchar *domain, const gchar *msgid) G_GNUC_FORMAT(2); -const gchar * g_dcgettext (const gchar *domain, +G_CONST_RETURN gchar *g_dcgettext (const gchar *domain, const gchar *msgid, int category) G_GNUC_FORMAT(2); -const gchar * g_dngettext (const gchar *domain, +G_CONST_RETURN gchar *g_dngettext (const gchar *domain, const gchar *msgid, const gchar *msgid_plural, gulong n) G_GNUC_FORMAT(3); -const gchar * g_dpgettext (const gchar *domain, +G_CONST_RETURN gchar *g_dpgettext (const gchar *domain, const gchar *msgctxtid, gsize msgidoffset) G_GNUC_FORMAT(2); -const gchar * g_dpgettext2 (const gchar *domain, +G_CONST_RETURN gchar *g_dpgettext2 (const gchar *domain, const gchar *context, const gchar *msgid) G_GNUC_FORMAT(3); diff --git a/glib/gunicode.h b/glib/gunicode.h index d7a68c2ab..c64f5f48d 100644 --- a/glib/gunicode.h +++ b/glib/gunicode.h @@ -236,7 +236,7 @@ typedef enum * in case the locale's charset will be changed later using setlocale() * or in some other way. */ -gboolean g_get_charset (const char **charset); +gboolean g_get_charset (G_CONST_RETURN char **charset); /* These are all analogs of the <ctype.h> functions. */ diff --git a/glib/gutf8.c b/glib/gutf8.c index 3e80b9245..98f470716 100644 --- a/glib/gutf8.c +++ b/glib/gutf8.c @@ -553,7 +553,7 @@ charset_cache_free (gpointer data) * Return value: %TRUE if the returned charset is UTF-8 **/ gboolean -g_get_charset (const char **charset) +g_get_charset (G_CONST_RETURN char **charset) { static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT; GCharsetCache *cache = g_static_private_get (&cache_private); diff --git a/glib/gutils.c b/glib/gutils.c index c87015212..6d9dbe961 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -711,7 +711,7 @@ g_parse_debug_string (const gchar *string, * g_path_get_basename() allocates new memory for the returned string, unlike * this function which returns a pointer into the argument. **/ -const gchar * +G_CONST_RETURN gchar* g_basename (const gchar *file_name) { register gchar *base; @@ -857,7 +857,7 @@ g_path_is_absolute (const gchar *file_name) * * Returns: a pointer into @file_name after the root component. */ -const gchar * +G_CONST_RETURN gchar* g_path_skip_root (const gchar *file_name) { g_return_val_if_fail (file_name != NULL, NULL); @@ -1108,7 +1108,7 @@ g_get_current_dir (void) * overwritten by the next call to g_getenv(), g_setenv() or * g_unsetenv(). **/ -const gchar * +G_CONST_RETURN gchar* g_getenv (const gchar *variable) { #ifndef G_OS_WIN32 @@ -1872,7 +1872,7 @@ g_get_any_init_locked (void) * * Returns: the user name of the current user. */ -const gchar * +G_CONST_RETURN gchar* g_get_user_name (void) { g_get_any_init_locked (); @@ -1890,7 +1890,7 @@ g_get_user_name (void) * * Returns: the user's real name. */ -const gchar * +G_CONST_RETURN gchar* g_get_real_name (void) { g_get_any_init_locked (); @@ -1928,7 +1928,7 @@ g_get_real_name (void) * * Returns: the current user's home directory */ -const gchar * +G_CONST_RETURN gchar* g_get_home_dir (void) { g_get_any_init_locked (); @@ -1947,7 +1947,7 @@ g_get_home_dir (void) * * Returns: the directory to use for temporary files. */ -const gchar * +G_CONST_RETURN gchar* g_get_tmp_dir (void) { g_get_any_init_locked (); @@ -2066,7 +2066,7 @@ static gchar *g_application_name = NULL; * * Since: 2.2 **/ -const gchar * +G_CONST_RETURN gchar* g_get_application_name (void) { gchar* retval; @@ -2135,7 +2135,7 @@ g_set_application_name (const gchar *application_name) * or freed. * Since: 2.6 **/ -const gchar * +G_CONST_RETURN gchar* g_get_user_data_dir (void) { gchar *data_dir; @@ -2223,7 +2223,7 @@ g_init_user_config_dir (void) * or freed. * Since: 2.6 **/ -const gchar * +G_CONST_RETURN gchar* g_get_user_config_dir (void) { G_LOCK (g_utils_global); @@ -2255,7 +2255,7 @@ g_get_user_config_dir (void) * or freed. * Since: 2.6 **/ -const gchar * +G_CONST_RETURN gchar* g_get_user_cache_dir (void) { gchar *cache_dir; @@ -2700,7 +2700,7 @@ g_reload_user_special_dirs_cache (void) * * Since: 2.14 */ -const gchar * +G_CONST_RETURN gchar * g_get_user_special_dir (GUserDirectory directory) { g_return_val_if_fail (directory >= G_USER_DIRECTORY_DESKTOP && @@ -2785,7 +2785,7 @@ get_module_share_dir (gconstpointer address) return retval; } -const gchar * const * +G_CONST_RETURN gchar * G_CONST_RETURN * g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) { GArray *data_dirs; @@ -2810,7 +2810,7 @@ g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) if (retval != NULL) { G_UNLOCK (g_utils_global); - return (const gchar * const *) retval; + return (G_CONST_RETURN gchar * G_CONST_RETURN *) retval; } } } @@ -2878,7 +2878,7 @@ g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) G_UNLOCK (g_utils_global); } - return (const gchar * const *) retval; + return (G_CONST_RETURN gchar * G_CONST_RETURN *) retval; } #endif @@ -2920,7 +2920,7 @@ g_win32_get_system_data_dirs_for_module (void (*address_of_function)()) * not be modified or freed. * Since: 2.6 **/ -const gchar * const * +G_CONST_RETURN gchar * G_CONST_RETURN * g_get_system_data_dirs (void) { gchar **data_dir_vector; @@ -2947,7 +2947,7 @@ g_get_system_data_dirs (void) G_UNLOCK (g_utils_global); - return (const gchar * const *) data_dir_vector; + return (G_CONST_RETURN gchar * G_CONST_RETURN *) data_dir_vector; } /** @@ -2972,7 +2972,7 @@ g_get_system_data_dirs (void) * not be modified or freed. * Since: 2.6 **/ -const gchar * const * +G_CONST_RETURN gchar * G_CONST_RETURN * g_get_system_config_dirs (void) { gchar *conf_dirs, **conf_dir_vector; @@ -3008,7 +3008,7 @@ g_get_system_config_dirs (void) conf_dir_vector = g_system_config_dirs; G_UNLOCK (g_utils_global); - return (const gchar * const *) conf_dir_vector; + return (G_CONST_RETURN gchar * G_CONST_RETURN *) conf_dir_vector; } #ifndef G_OS_WIN32 @@ -3333,7 +3333,7 @@ language_names_cache_free (gpointer data) * * Since: 2.6 **/ -const gchar * const * +G_CONST_RETURN gchar * G_CONST_RETURN * g_get_language_names (void) { static GStaticPrivate cache_private = G_STATIC_PRIVATE_INIT; @@ -3371,7 +3371,7 @@ g_get_language_names (void) cache->language_names = (gchar **) g_ptr_array_free (array, FALSE); } - return (const gchar * const *) cache->language_names; + return (G_CONST_RETURN gchar * G_CONST_RETURN *) cache->language_names; } /** @@ -3642,7 +3642,7 @@ ensure_gettext_initialized(void) * * Returns: the transation of @str to the current locale */ -const gchar * +G_CONST_RETURN gchar * glib_gettext (const gchar *str) { ensure_gettext_initialized(); @@ -3665,7 +3665,7 @@ glib_gettext (const gchar *str) * * Returns: the transation of @str to the current locale */ -const gchar * +G_CONST_RETURN gchar * glib_pgettext(const gchar *msgctxtid, gsize msgidoffset) { @@ -3709,7 +3709,7 @@ g_get_current_dir (void) #undef g_getenv -const gchar * +G_CONST_RETURN gchar* g_getenv (const gchar *variable) { gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL); @@ -3758,7 +3758,7 @@ g_unsetenv (const gchar *variable) #undef g_get_user_name -const gchar * +G_CONST_RETURN gchar* g_get_user_name (void) { g_get_any_init_locked (); @@ -3767,7 +3767,7 @@ g_get_user_name (void) #undef g_get_real_name -const gchar * +G_CONST_RETURN gchar* g_get_real_name (void) { g_get_any_init_locked (); @@ -3776,7 +3776,7 @@ g_get_real_name (void) #undef g_get_home_dir -const gchar * +G_CONST_RETURN gchar* g_get_home_dir (void) { g_get_any_init_locked (); @@ -3785,7 +3785,7 @@ g_get_home_dir (void) #undef g_get_tmp_dir -const gchar * +G_CONST_RETURN gchar* g_get_tmp_dir (void) { g_get_any_init_locked (); diff --git a/glib/gutils.h b/glib/gutils.h index bbb59998c..6b94efde3 100644 --- a/glib/gutils.h +++ b/glib/gutils.h @@ -117,25 +117,25 @@ G_BEGIN_DECLS #define g_get_tmp_dir g_get_tmp_dir_utf8 #endif -const gchar * g_get_user_name (void); -const gchar * g_get_real_name (void); -const gchar * g_get_home_dir (void); -const gchar * g_get_tmp_dir (void); -const gchar * g_get_host_name (void); -gchar * g_get_prgname (void); +G_CONST_RETURN gchar* g_get_user_name (void); +G_CONST_RETURN gchar* g_get_real_name (void); +G_CONST_RETURN gchar* g_get_home_dir (void); +G_CONST_RETURN gchar* g_get_tmp_dir (void); +G_CONST_RETURN gchar* g_get_host_name (void); +gchar* g_get_prgname (void); void g_set_prgname (const gchar *prgname); -const gchar * g_get_application_name (void); +G_CONST_RETURN gchar* g_get_application_name (void); void g_set_application_name (const gchar *application_name); void g_reload_user_special_dirs_cache (void); -const gchar * g_get_user_data_dir (void); -const gchar * g_get_user_config_dir (void); -const gchar * g_get_user_cache_dir (void); -const gchar * const * g_get_system_data_dirs (void); +G_CONST_RETURN gchar* g_get_user_data_dir (void); +G_CONST_RETURN gchar* g_get_user_config_dir (void); +G_CONST_RETURN gchar* g_get_user_cache_dir (void); +G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_data_dirs (void); #ifdef G_OS_WIN32 /* This functions is not part of the public GLib API */ -const gchar* const * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)); +G_CONST_RETURN gchar* G_CONST_RETURN * g_win32_get_system_data_dirs_for_module (void (*address_of_function)(void)); #endif #if defined (G_OS_WIN32) && defined (G_CAN_INLINE) && !defined (__cplusplus) @@ -143,7 +143,7 @@ const gchar* const * g_win32_get_system_data_dirs_for_module (void (*address_of_ * g_get_system_data_dirs() in your code, never mind that that is * actually a macro and you will in fact call this inline function. */ -static inline const gchar * const * +static inline G_CONST_RETURN gchar * G_CONST_RETURN * _g_win32_get_system_data_dirs (void) { return g_win32_get_system_data_dirs_for_module ((void (*)(void)) &_g_win32_get_system_data_dirs); @@ -151,11 +151,11 @@ _g_win32_get_system_data_dirs (void) #define g_get_system_data_dirs _g_win32_get_system_data_dirs #endif -const gchar * const * g_get_system_config_dirs (void); +G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_config_dirs (void); const gchar * g_get_user_runtime_dir (void); -const gchar * const * g_get_language_names (void); +G_CONST_RETURN gchar* G_CONST_RETURN * g_get_language_names (void); gchar **g_get_locale_variants (const gchar *locale); @@ -194,7 +194,7 @@ typedef enum { G_USER_N_DIRECTORIES } GUserDirectory; -const gchar * g_get_user_special_dir (GUserDirectory directory); +G_CONST_RETURN gchar* g_get_user_special_dir (GUserDirectory directory); typedef struct _GDebugKey GDebugKey; struct _GDebugKey @@ -222,7 +222,7 @@ gint g_vsnprintf (gchar *string, gboolean g_path_is_absolute (const gchar *file_name); /* In case of absolute paths, skip the root part */ -const gchar * g_path_skip_root (const gchar *file_name); +G_CONST_RETURN gchar* g_path_skip_root (const gchar *file_name); #ifndef G_DISABLE_DEPRECATED @@ -230,7 +230,7 @@ const gchar * g_path_skip_root (const gchar *file_name); * major release of GLib. Use g_path_get_dirname/g_path_get_basename * instead. Whatch out! The string returned by g_path_get_basename * must be g_freed, while the string returned by g_basename must not.*/ -const gchar * g_basename (const gchar *file_name); +G_CONST_RETURN gchar* g_basename (const gchar *file_name); #define g_dirname g_path_get_dirname #endif /* G_DISABLE_DEPRECATED */ @@ -256,7 +256,7 @@ void g_nullify_pointer (gpointer *nullify_location); #define g_find_program_in_path g_find_program_in_path_utf8 #endif -const gchar * g_getenv (const gchar *variable); +G_CONST_RETURN gchar* g_getenv (const gchar *variable); gboolean g_setenv (const gchar *variable, const gchar *value, gboolean overwrite); diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c index 3e076ec86..2d7f410b6 100644 --- a/gmodule/gmodule.c +++ b/gmodule/gmodule.c @@ -598,7 +598,7 @@ g_module_make_resident (GModule *module) module->is_resident = TRUE; } -const gchar * +G_CONST_RETURN gchar* g_module_error (void) { return g_static_private_get (&module_error_private); @@ -648,7 +648,7 @@ g_module_symbol (GModule *module, return !module_error; } -const gchar * +G_CONST_RETURN gchar* g_module_name (GModule *module) { g_return_val_if_fail (module != NULL, NULL); @@ -663,7 +663,7 @@ g_module_name (GModule *module) #undef g_module_name -const gchar * +G_CONST_RETURN gchar* g_module_name (GModule *module) { g_return_val_if_fail (module != NULL, NULL); diff --git a/gmodule/gmodule.h b/gmodule/gmodule.h index 5f18f9db1..ae7f8e54a 100644 --- a/gmodule/gmodule.h +++ b/gmodule/gmodule.h @@ -71,7 +71,7 @@ gboolean g_module_close (GModule *module); void g_module_make_resident (GModule *module); /* query the last module error as a string */ -const gchar * g_module_error (void); +G_CONST_RETURN gchar* g_module_error (void); /* retrieve a symbol pointer from `module', returns TRUE on success */ gboolean g_module_symbol (GModule *module, @@ -79,7 +79,7 @@ gboolean g_module_symbol (GModule *module, gpointer *symbol); /* retrieve the file name from an existing module */ -const gchar * g_module_name (GModule *module); +G_CONST_RETURN gchar* g_module_name (GModule *module); /* Build the actual file name containing a module. `directory' is the * directory where the module file is supposed to be, or NULL or empty diff --git a/gobject/gbinding.c b/gobject/gbinding.c index 99a720786..c73c4e654 100644 --- a/gobject/gbinding.c +++ b/gobject/gbinding.c @@ -742,7 +742,7 @@ g_binding_get_target (GBinding *binding) * * Since: 2.26 */ -const gchar * +G_CONST_RETURN gchar * g_binding_get_source_property (GBinding *binding) { g_return_val_if_fail (G_IS_BINDING (binding), NULL); @@ -761,7 +761,7 @@ g_binding_get_source_property (GBinding *binding) * * Since: 2.26 */ -const gchar * +G_CONST_RETURN gchar * g_binding_get_target_property (GBinding *binding) { g_return_val_if_fail (G_IS_BINDING (binding), NULL); diff --git a/gobject/gbinding.h b/gobject/gbinding.h index 1b715402e..fe6799d43 100644 --- a/gobject/gbinding.h +++ b/gobject/gbinding.h @@ -106,8 +106,8 @@ GType g_binding_get_type (void) G_GNUC_CONST; GBindingFlags g_binding_get_flags (GBinding *binding); GObject * g_binding_get_source (GBinding *binding); GObject * g_binding_get_target (GBinding *binding); -const gchar * g_binding_get_source_property (GBinding *binding); -const gchar * g_binding_get_target_property (GBinding *binding); +G_CONST_RETURN gchar *g_binding_get_source_property (GBinding *binding); +G_CONST_RETURN gchar *g_binding_get_target_property (GBinding *binding); GBinding *g_object_bind_property (gpointer source, const gchar *source_property, diff --git a/gobject/gparam.c b/gobject/gparam.c index b1be1e681..bca47d225 100644 --- a/gobject/gparam.c +++ b/gobject/gparam.c @@ -282,7 +282,7 @@ g_param_spec_ref_sink (GParamSpec *pspec) * * Returns: the name of @pspec. */ -const gchar * +G_CONST_RETURN gchar* g_param_spec_get_name (GParamSpec *pspec) { g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL); @@ -298,7 +298,7 @@ g_param_spec_get_name (GParamSpec *pspec) * * Returns: the nickname of @pspec. */ -const gchar * +G_CONST_RETURN gchar* g_param_spec_get_nick (GParamSpec *pspec) { g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL); @@ -325,7 +325,7 @@ g_param_spec_get_nick (GParamSpec *pspec) * * Returns: the short description of @pspec. */ -const gchar * +G_CONST_RETURN gchar* g_param_spec_get_blurb (GParamSpec *pspec) { g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL); diff --git a/gobject/gparam.h b/gobject/gparam.h index 5ee41ab91..9b93c0af4 100644 --- a/gobject/gparam.h +++ b/gobject/gparam.h @@ -301,9 +301,9 @@ gboolean g_param_value_convert (GParamSpec *pspec, gint g_param_values_cmp (GParamSpec *pspec, const GValue *value1, const GValue *value2); -const gchar * g_param_spec_get_name (GParamSpec *pspec); -const gchar * g_param_spec_get_nick (GParamSpec *pspec); -const gchar * g_param_spec_get_blurb (GParamSpec *pspec); +G_CONST_RETURN gchar* g_param_spec_get_name (GParamSpec *pspec); +G_CONST_RETURN gchar* g_param_spec_get_nick (GParamSpec *pspec); +G_CONST_RETURN gchar* g_param_spec_get_blurb (GParamSpec *pspec); void g_value_set_param (GValue *value, GParamSpec *param); GParamSpec* g_value_get_param (const GValue *value); diff --git a/gobject/gsignal.c b/gobject/gsignal.c index 6bc4d40e0..c4375b111 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -1223,7 +1223,7 @@ g_signal_list_ids (GType itype, * * Returns: the signal name, or %NULL if the signal number was invalid. */ -const gchar * +G_CONST_RETURN gchar* g_signal_name (guint signal_id) { SignalNode *node; diff --git a/gobject/gsignal.h b/gobject/gsignal.h index 8f1639e88..24ef842cc 100644 --- a/gobject/gsignal.h +++ b/gobject/gsignal.h @@ -308,7 +308,7 @@ void g_signal_emit_by_name (gpointer instance, ...); guint g_signal_lookup (const gchar *name, GType itype); -const gchar * g_signal_name (guint signal_id); +G_CONST_RETURN gchar* g_signal_name (guint signal_id); void g_signal_query (guint signal_id, GSignalQuery *query); guint* g_signal_list_ids (GType itype, diff --git a/gobject/gtype.c b/gobject/gtype.c index 8f976cdbb..943993962 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -3279,7 +3279,7 @@ g_type_default_interface_unref (gpointer g_iface) * * Returns: Static type name or %NULL. */ -const gchar * +G_CONST_RETURN gchar* g_type_name (GType type) { TypeNode *node; @@ -4206,7 +4206,7 @@ g_type_value_table_peek (GType type) return NULL; } -const gchar * +G_CONST_RETURN gchar* g_type_name_from_instance (GTypeInstance *instance) { if (!instance) @@ -4215,7 +4215,7 @@ g_type_name_from_instance (GTypeInstance *instance) return g_type_name_from_class (instance->g_class); } -const gchar * +G_CONST_RETURN gchar* g_type_name_from_class (GTypeClass *g_class) { if (!g_class) diff --git a/gobject/gtype.h b/gobject/gtype.h index 7ba9364ba..549ba036e 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -666,7 +666,7 @@ typedef enum /*< skip >*/ /* --- prototypes --- */ void g_type_init (void); void g_type_init_with_debug_flags (GTypeDebugFlags debug_flags); -const gchar * g_type_name (GType type); +G_CONST_RETURN gchar* g_type_name (GType type); GQuark g_type_qname (GType type); GType g_type_from_name (const gchar *name); GType g_type_parent (GType type); @@ -1657,8 +1657,8 @@ gboolean g_type_test_flags (GType type, /* --- debugging functions --- */ -const gchar * g_type_name_from_instance (GTypeInstance *instance); -const gchar * g_type_name_from_class (GTypeClass *g_class); +G_CONST_RETURN gchar* g_type_name_from_instance (GTypeInstance *instance); +G_CONST_RETURN gchar* g_type_name_from_class (GTypeClass *g_class); /* --- internal functions --- */ diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c index 3f918f44c..78c7266d4 100644 --- a/gobject/gvaluetypes.c +++ b/gobject/gvaluetypes.c @@ -1073,7 +1073,7 @@ g_value_take_string (GValue *value, * * Returns: string content of @value */ -const gchar * +G_CONST_RETURN gchar* g_value_get_string (const GValue *value) { g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL); diff --git a/gobject/gvaluetypes.h b/gobject/gvaluetypes.h index 972c8689c..3d3f7b639 100644 --- a/gobject/gvaluetypes.h +++ b/gobject/gvaluetypes.h @@ -214,7 +214,7 @@ void g_value_set_string (GValue *value, const gchar *v_string); void g_value_set_static_string (GValue *value, const gchar *v_string); -const gchar * g_value_get_string (const GValue *value); +G_CONST_RETURN gchar* g_value_get_string (const GValue *value); gchar* g_value_dup_string (const GValue *value); void g_value_set_pointer (GValue *value, gpointer v_pointer); |