include string.h

2001-02-17  Havoc Pennington  <hp@pobox.com>

	* gthread.c: include string.h

        Applied patch from Soeren Sandmann:

	* testglib.c: const fixes

	* gwin32.h: format cleanups

	* gutils.c (g_atexit): constify a variable
	(g_find_program_in_path): constification
	(g_basename): G_CONST_RETURN
	(g_path_skip_root): G_CONST_RETURN
	(g_getenv): G_CONST_RETURN
	(g_get_user_name): G_CONST_RETURN
	(g_get_real_name): G_CONST_RETURN
	(g_get_home_dir): G_CONST_RETURN
	(g_get_tmp_dir): G_CONST_RETURN
	(g_get_prgname): G_CONST_RETURN
	(_glib_gettext): G_CONST_RETURN

	* gunicode.h: formatting cleanups

	* gstrfuncs.c (g_strerror): G_CONST_RETURN
	(g_strsignal): G_CONST_RETURN

	* gspawn.c (g_execute): const on variables

	* gmessages.c (printf_string_upper_bound): fix const on a variable

	* gmem.c (g_mem_chunk_new): make the "name" arg const
	(struct _GRealMemChunk): make the "name" field const

	* gfileutils.c (g_file_open_tmp): store const return in a const
	gchar* variable

	* gdataset.c (g_quark_to_string): G_CONST_RETURN

2001-02-17  Havoc Pennington  <hp@pobox.com>

        Applied patch from Soeren Sandmann:

	* gvaluetypes.c (g_value_get_string): G_CONST_RETURN

	* gtype.c (g_type_name): G_CONST_RETURN

	* gsignal.c (g_signal_name): G_CONST_RETURN

	* gobject-query.c (main): const fix

2001-02-17  Havoc Pennington  <hp@pobox.com>

        Applied patch from Soeren Sandmann:

	* gmodule.c (g_module_error): G_CONST_RETURN
	(g_module_name): G_CONST_RETURN
This commit is contained in:
Havoc Pennington 2001-02-17 23:30:48 +00:00 committed by Havoc Pennington
parent adfafc0872
commit 1c391cc698
49 changed files with 766 additions and 423 deletions

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -1,3 +1,42 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
* gthread.c: include string.h
Applied patch from Soeren Sandmann:
* testglib.c: const fixes
* gwin32.h: format cleanups
* gutils.c (g_atexit): constify a variable
(g_find_program_in_path): constification
(g_basename): G_CONST_RETURN
(g_path_skip_root): G_CONST_RETURN
(g_getenv): G_CONST_RETURN
(g_get_user_name): G_CONST_RETURN
(g_get_real_name): G_CONST_RETURN
(g_get_home_dir): G_CONST_RETURN
(g_get_tmp_dir): G_CONST_RETURN
(g_get_prgname): G_CONST_RETURN
(_glib_gettext): G_CONST_RETURN
* gunicode.h: formatting cleanups
* gstrfuncs.c (g_strerror): G_CONST_RETURN
(g_strsignal): G_CONST_RETURN
* gspawn.c (g_execute): const on variables
* gmessages.c (printf_string_upper_bound): fix const on a variable
* gmem.c (g_mem_chunk_new): make the "name" arg const
(struct _GRealMemChunk): make the "name" field const
* gfileutils.c (g_file_open_tmp): store const return in a const
gchar* variable
* gdataset.c (g_quark_to_string): G_CONST_RETURN
Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:26:33 2001 Tim Janik <timj@gtk.org>
* configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL * configure.in (G_MODULE_HAVE_DLERROR): add check for broken RTLD_GLOBAL

View File

@ -595,7 +595,7 @@ g_quark_from_static_string (const gchar *string)
return quark; return quark;
} }
gchar* G_CONST_RETURN gchar*
g_quark_to_string (GQuark quark) g_quark_to_string (GQuark quark)
{ {
gchar* result = NULL; gchar* result = NULL;

View File

@ -618,7 +618,7 @@ g_file_open_tmp (const char *tmpl,
GError **error) GError **error)
{ {
int retval; int retval;
char *tmpdir; const char *tmpdir;
char *sep; char *sep;
char *fulltemplate; char *fulltemplate;

View File

@ -595,7 +595,7 @@ g_quark_from_static_string (const gchar *string)
return quark; return quark;
} }
gchar* G_CONST_RETURN gchar*
g_quark_to_string (GQuark quark) g_quark_to_string (GQuark quark)
{ {
gchar* result = NULL; gchar* result = NULL;

View File

@ -618,7 +618,7 @@ g_file_open_tmp (const char *tmpl,
GError **error) GError **error)
{ {
int retval; int retval;
char *tmpdir; const char *tmpdir;
char *sep; char *sep;
char *fulltemplate; char *fulltemplate;

View File

@ -591,7 +591,7 @@ struct _GMemArea
struct _GRealMemChunk struct _GRealMemChunk
{ {
gchar *name; /* name of this MemChunk...used for debugging output */ const gchar *name; /* name of this MemChunk...used for debugging output */
gint type; /* the type of MemChunk: ALLOC_ONLY or ALLOC_AND_FREE */ gint type; /* the type of MemChunk: ALLOC_ONLY or ALLOC_AND_FREE */
gint num_mem_areas; /* the number of memory areas */ gint num_mem_areas; /* the number of memory areas */
gint num_marked_areas; /* the number of areas marked for deletion */ gint num_marked_areas; /* the number of areas marked for deletion */
@ -622,10 +622,10 @@ static GMutex *mem_chunks_lock = NULL;
static GRealMemChunk *mem_chunks = NULL; static GRealMemChunk *mem_chunks = NULL;
GMemChunk* GMemChunk*
g_mem_chunk_new (gchar *name, g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type) gint type)
{ {
GRealMemChunk *mem_chunk; GRealMemChunk *mem_chunk;
gulong rarea_size; gulong rarea_size;
@ -1135,10 +1135,10 @@ typedef struct {
} GMinimalMemChunk; } GMinimalMemChunk;
GMemChunk* GMemChunk*
g_mem_chunk_new (gchar *name, g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type) gint type)
{ {
GMinimalMemChunk *mem_chunk; GMinimalMemChunk *mem_chunk;

View File

@ -132,19 +132,19 @@ void g_mem_profile (void);
#define G_ALLOC_ONLY 1 #define G_ALLOC_ONLY 1
#define G_ALLOC_AND_FREE 2 #define G_ALLOC_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name, GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type); gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk); void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk, void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem); gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk); void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk); void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk); void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void); void g_mem_chunk_info (void);
/* Ah yes...we have a "g_blow_chunks" function. /* Ah yes...we have a "g_blow_chunks" function.
* "g_blow_chunks" simply compresses all the chunks. This operation * "g_blow_chunks" simply compresses all the chunks. This operation

View File

@ -879,7 +879,7 @@ printf_string_upper_bound (const gchar *format,
GDoubleIEEE754 u_double; GDoubleIEEE754 u_double;
guint v_uint; guint v_uint;
gint v_int; gint v_int;
gchar *v_string; const gchar *v_string;
/* beware of positional parameters /* beware of positional parameters
*/ */

View File

@ -35,10 +35,10 @@ typedef guint32 GQuark;
/* Quarks (string<->id association) /* Quarks (string<->id association)
*/ */
GQuark g_quark_try_string (const gchar *string); GQuark g_quark_try_string (const gchar *string);
GQuark g_quark_from_static_string (const gchar *string); GQuark g_quark_from_static_string (const gchar *string);
GQuark g_quark_from_string (const gchar *string); GQuark g_quark_from_string (const gchar *string);
gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST; G_CONST_RETURN gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST;
G_END_DECLS G_END_DECLS

View File

@ -1288,7 +1288,8 @@ g_execute (const gchar *file,
else else
{ {
gboolean got_eacces = 0; gboolean got_eacces = 0;
char *path, *p, *name, *freeme; const gchar *path, *p;
gchar *name, *freeme;
size_t len; size_t len;
size_t pathlen; size_t pathlen;

View File

@ -226,7 +226,7 @@ g_strtod (const gchar *nptr,
} }
} }
gchar* G_CONST_RETURN gchar*
g_strerror (gint errnum) g_strerror (gint errnum)
{ {
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
@ -669,7 +669,7 @@ g_strerror (gint errnum)
return msg; return msg;
} }
gchar* G_CONST_RETURN gchar*
g_strsignal (gint signum) g_strsignal (gint signum)
{ {
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;

View File

@ -36,58 +36,58 @@ G_BEGIN_DECLS
* return a constant string that must not be freed. * return a constant string that must not be freed.
*/ */
#define G_STR_DELIMITERS "_-|> <." #define G_STR_DELIMITERS "_-|> <."
gchar* g_strdelimit (gchar *string, gchar* g_strdelimit (gchar *string,
const gchar *delimiters, const gchar *delimiters,
gchar new_delimiter); gchar new_delimiter);
gchar* g_strcanon (gchar *string, gchar* g_strcanon (gchar *string,
const gchar *valid_chars, const gchar *valid_chars,
gchar subsitutor); gchar subsitutor);
gdouble g_strtod (const gchar *nptr, gdouble g_strtod (const gchar *nptr,
gchar **endptr); gchar **endptr);
gchar* g_strerror (gint errnum) G_GNUC_CONST; G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
gchar* g_strsignal (gint signum) G_GNUC_CONST; G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1, gint g_strcasecmp (const gchar *s1,
const gchar *s2); const gchar *s2);
gint g_strncasecmp (const gchar *s1, gint g_strncasecmp (const gchar *s1,
const gchar *s2, const gchar *s2,
guint n); guint n);
gchar* g_strdown (gchar *string); gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string); gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string); gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest, gsize g_strlcpy (gchar *dest,
const gchar *src, const gchar *src,
gsize dest_size); gsize dest_size);
gsize g_strlcat (gchar *dest, gsize g_strlcat (gchar *dest,
const gchar *src, const gchar *src,
gsize dest_size); gsize dest_size);
/* removes leading spaces */ /* removes leading spaces */
gchar* g_strchug (gchar *string); gchar* g_strchug (gchar *string);
/* removes trailing spaces */ /* removes trailing spaces */
gchar* g_strchomp (gchar *string); gchar* g_strchomp (gchar *string);
/* removes leading & trailing spaces */ /* removes leading & trailing spaces */
#define g_strstrip( string ) g_strchomp (g_strchug (string)) #define g_strstrip( string ) g_strchomp (g_strchug (string))
/* String utility functions that return a newly allocated string which /* String utility functions that return a newly allocated string which
* ought to be freed with g_free from the caller at some point. * 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);
gchar* g_strdup_printf (const gchar *format, gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format, gchar* g_strdup_vprintf (const gchar *format,
va_list args); va_list args);
gchar* g_strndup (const gchar *str, gchar* g_strndup (const gchar *str,
guint n); guint n);
gchar* g_strnfill (guint length, gchar* g_strnfill (guint length,
gchar fill_char); gchar fill_char);
gchar* g_strconcat (const gchar *string1, gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */ ...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator, gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */ ...); /* NULL terminated */
/* Make a copy of a string interpreting C string -style escape /* Make a copy of a string interpreting C string -style escape
* sequences. Inverse of g_strescape. The recognized sequences are \b * sequences. Inverse of g_strescape. The recognized sequences are \b
* \f \n \r \t \\ \" and the octal format. * \f \n \r \t \\ \" and the octal format.
*/ */
gchar* g_strcompress (const gchar *source); gchar* g_strcompress (const gchar *source);
/* Copy a string escaping nonprintable characters like in C strings. /* Copy a string escaping nonprintable characters like in C strings.
* Inverse of g_strcompress. The exceptions parameter, if non-NULL, points * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
@ -97,11 +97,11 @@ gchar* g_strcompress (const gchar *source);
* Luckily this function wasn't used much, using NULL as second parameter * Luckily this function wasn't used much, using NULL as second parameter
* provides mostly identical semantics. * provides mostly identical semantics.
*/ */
gchar* g_strescape (const gchar *source, gchar* g_strescape (const gchar *source,
const gchar *exceptions); const gchar *exceptions);
gpointer g_memdup (gconstpointer mem, gpointer g_memdup (gconstpointer mem,
guint byte_size); guint byte_size);
/* NULL terminated string arrays. /* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and * g_strsplit() splits up string into max_tokens tokens at delim and
@ -111,13 +111,13 @@ gpointer g_memdup (gconstpointer mem,
* g_strfreev() frees the array itself and all of its strings. * g_strfreev() frees the array itself and all of its strings.
* g_strdupv() copies a NULL-terminated array of strings * g_strdupv() copies a NULL-terminated array of strings
*/ */
gchar** g_strsplit (const gchar *string, gchar** g_strsplit (const gchar *string,
const gchar *delimiter, const gchar *delimiter,
gint max_tokens); gint max_tokens);
gchar* g_strjoinv (const gchar *separator, gchar* g_strjoinv (const gchar *separator,
gchar **str_array); gchar **str_array);
void g_strfreev (gchar **str_array); void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array); gchar** g_strdupv (gchar **str_array);
G_END_DECLS G_END_DECLS

View File

@ -46,6 +46,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <string.h>
#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P #if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
# define g_system_thread_equal(thread1, thread2) \ # define g_system_thread_equal(thread1, thread2) \
(thread1.dummy_pointer == thread2.dummy_pointer) (thread1.dummy_pointer == thread2.dummy_pointer)

View File

@ -180,30 +180,30 @@ GLIB_VAR char g_utf8_skip[256];
#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)]) #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)])
gunichar g_utf8_get_char (const gchar *p); gunichar g_utf8_get_char (const gchar *p);
gchar * g_utf8_offset_to_pointer (const gchar *str, gchar* g_utf8_offset_to_pointer (const gchar *str,
gint offset); gint offset);
gint g_utf8_pointer_to_offset (const gchar *str, gint g_utf8_pointer_to_offset (const gchar *str,
const gchar *pos); const gchar *pos);
gchar * g_utf8_prev_char (const gchar *p); gchar* g_utf8_prev_char (const gchar *p);
gchar * g_utf8_find_next_char (const gchar *p, gchar* g_utf8_find_next_char (const gchar *p,
const gchar *end); const gchar *end);
gchar * g_utf8_find_prev_char (const gchar *str, gchar* g_utf8_find_prev_char (const gchar *str,
const gchar *p); const gchar *p);
gint g_utf8_strlen (const gchar *p, gint g_utf8_strlen (const gchar *p,
gint max); gint max);
/* Copies n characters from src to dest */ /* Copies n characters from src to dest */
gchar *g_utf8_strncpy (gchar *dest, gchar* g_utf8_strncpy (gchar *dest,
const gchar *src, const gchar *src,
size_t n); size_t n);
/* Find the UTF-8 character corresponding to ch, in string p. These /* Find the UTF-8 character corresponding to ch, in string p. These
functions are equivalants to strchr and strrchr */ functions are equivalants to strchr and strrchr */
gchar *g_utf8_strchr (const gchar *p, gchar* g_utf8_strchr (const gchar *p,
gunichar c); gunichar c);
gchar *g_utf8_strrchr (const gchar *p, gchar* g_utf8_strrchr (const gchar *p,
gunichar c); gunichar c);
gunichar2 *g_utf8_to_utf16 (const gchar *str, gunichar2 *g_utf8_to_utf16 (const gchar *str,
@ -224,7 +224,7 @@ gunichar * g_utf16_to_ucs4 (const gunichar2 *str,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
GError **error); GError **error);
gchar * g_utf16_to_utf8 (const gunichar2 *str, gchar* g_utf16_to_utf8 (const gunichar2 *str,
gint len, gint len,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
@ -234,7 +234,7 @@ gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
GError **error); GError **error);
gchar * g_ucs4_to_utf8 (const gunichar *str, gchar* g_ucs4_to_utf8 (const gunichar *str,
gint len, gint len,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,

View File

@ -111,7 +111,7 @@ void
g_atexit (GVoidFunc func) g_atexit (GVoidFunc func)
{ {
gint result; gint result;
gchar *error = NULL; const gchar *error = NULL;
/* keep this in sync with glib.h */ /* keep this in sync with glib.h */
@ -171,7 +171,8 @@ my_strchrnul (const gchar *str, gchar c)
gchar* gchar*
g_find_program_in_path (const gchar *program) g_find_program_in_path (const gchar *program)
{ {
gchar *path, *p, *name, *freeme; const gchar *path, *p;
gchar *name, *freeme;
size_t len; size_t len;
size_t pathlen; size_t pathlen;
@ -373,7 +374,7 @@ g_parse_debug_string (const gchar *string,
return result; return result;
} }
gchar* G_CONST_RETURN gchar*
g_basename (const gchar *file_name) g_basename (const gchar *file_name)
{ {
register gchar *base; register gchar *base;
@ -465,8 +466,8 @@ g_path_is_absolute (const gchar *file_name)
return FALSE; return FALSE;
} }
gchar* G_CONST_RETURN gchar*
g_path_skip_root (gchar *file_name) g_path_skip_root (const gchar *file_name)
{ {
g_return_val_if_fail (file_name != NULL, NULL); g_return_val_if_fail (file_name != NULL, NULL);
@ -490,7 +491,7 @@ g_path_skip_root (gchar *file_name)
if (file_name[0] == G_DIR_SEPARATOR) if (file_name[0] == G_DIR_SEPARATOR)
file_name++; file_name++;
return file_name; return (gchar *)file_name;
} }
} }
#endif #endif
@ -500,13 +501,13 @@ g_path_skip_root (gchar *file_name)
{ {
while (file_name[0] == G_DIR_SEPARATOR) while (file_name[0] == G_DIR_SEPARATOR)
file_name++; file_name++;
return file_name; return (gchar *)file_name;
} }
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* Skip X:\ */ /* Skip X:\ */
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR) if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return file_name + 3; return (gchar *)file_name + 3;
#endif #endif
return NULL; return NULL;
@ -597,7 +598,7 @@ g_get_current_dir (void)
return dir; return dir;
} }
gchar* G_CONST_RETURN gchar*
g_getenv (const gchar *variable) g_getenv (const gchar *variable)
{ {
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
@ -864,7 +865,7 @@ g_get_any_init (void)
} }
} }
gchar* G_CONST_RETURN gchar*
g_get_user_name (void) g_get_user_name (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -875,7 +876,7 @@ g_get_user_name (void)
return g_user_name; return g_user_name;
} }
gchar* G_CONST_RETURN gchar*
g_get_real_name (void) g_get_real_name (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -892,7 +893,7 @@ g_get_real_name (void)
* deduced, return NULL. * deduced, return NULL.
*/ */
gchar* G_CONST_RETURN gchar*
g_get_home_dir (void) g_get_home_dir (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -910,7 +911,7 @@ g_get_home_dir (void)
* and C:\ on Windows. * and C:\ on Windows.
*/ */
gchar* G_CONST_RETURN gchar*
g_get_tmp_dir (void) g_get_tmp_dir (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -1014,7 +1015,7 @@ g_get_codeset (void)
#endif /* G_OS_WIN32 */ #endif /* G_OS_WIN32 */
gchar * G_CONST_RETURN gchar *
_glib_gettext (const gchar *str) _glib_gettext (const gchar *str)
{ {
gboolean _glib_gettext_initialized = FALSE; gboolean _glib_gettext_initialized = FALSE;

View File

@ -113,12 +113,12 @@ G_BEGIN_DECLS
/* Retrive static string info /* Retrive static string info
*/ */
gchar* g_get_user_name (void); G_CONST_RETURN gchar* g_get_user_name (void);
gchar* g_get_real_name (void); G_CONST_RETURN gchar* g_get_real_name (void);
gchar* g_get_home_dir (void); G_CONST_RETURN gchar* g_get_home_dir (void);
gchar* g_get_tmp_dir (void); G_CONST_RETURN gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void); gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname); void g_set_prgname (const gchar *prgname);
typedef struct _GDebugKey GDebugKey; typedef struct _GDebugKey GDebugKey;
@ -130,40 +130,42 @@ struct _GDebugKey
/* Miscellaneous utility functions /* Miscellaneous utility functions
*/ */
guint g_parse_debug_string (const gchar *string, guint g_parse_debug_string (const gchar *string,
GDebugKey *keys, GDebugKey *keys,
guint nkeys); guint nkeys);
gint g_snprintf (gchar *string, gint g_snprintf (gchar *string,
gulong n, gulong n,
gchar const *format, gchar const *format,
...) G_GNUC_PRINTF (3, 4); ...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string, gint g_vsnprintf (gchar *string,
gulong n, gulong n,
gchar const *format, gchar const *format,
va_list args); va_list args);
/* Check if a file name is an absolute path */ /* Check if a file name is an absolute path */
gboolean g_path_is_absolute (const gchar *file_name); gboolean g_path_is_absolute (const gchar *file_name);
/* In case of absolute paths, skip the root part */ /* In case of absolute paths, skip the root part */
gchar* g_path_skip_root (gchar *file_name); G_CONST_RETURN gchar* g_path_skip_root (const gchar *file_name);
/* These two functions are deprecated and will be removed in the next /* These two functions are deprecated and will be removed in the next
* major release of GLib. Use g_path_get_dirname/g_path_get_basename * major release of GLib. Use g_path_get_dirname/g_path_get_basename
* instead. Whatch out! The string returned by 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.*/ * must be g_freed, while the string returned by g_basename must not.*/
gchar* g_basename (const gchar *file_name); G_CONST_RETURN gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name); gchar* g_dirname (const gchar *file_name);
/* The returned strings are newly allocated with g_malloc() */ /* The returned strings are newly allocated with g_malloc() */
gchar* g_get_current_dir (void); gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name); gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name); gchar* g_path_get_dirname (const gchar *file_name);
/* Get the codeset for the current locale */ /* Get the codeset for the current locale */
/* gchar * g_get_codeset (void); */ /* gchar * g_get_codeset (void); */
/* return the environment string for the variable. The returned memory /* return the environment string for the variable. The returned memory
* must not be freed. */ * must not be freed. */
gchar* g_getenv (const gchar *variable); G_CONST_RETURN gchar* g_getenv (const gchar *variable);
/* we try to provide a usefull equivalent for ATEXIT if it is /* we try to provide a usefull equivalent for ATEXIT if it is

View File

@ -102,18 +102,18 @@ gint g_win32_closedir (DIR *dir);
* returns it as a string of the above form for use in forming file * returns it as a string of the above form for use in forming file
* names etc. The returned string should be deallocated with g_free(). * names etc. The returned string should be deallocated with g_free().
*/ */
gchar * g_win32_getlocale (void); gchar* g_win32_getlocale (void);
/* Translate a Win32 error code (as returned by GetLastError()) into /* Translate a Win32 error code (as returned by GetLastError()) into
* the corresponding message. The returned string should be deallocated * the corresponding message. The returned string should be deallocated
* with g_free(). * with g_free().
*/ */
gchar * g_win32_error_message (gint error); gchar* g_win32_error_message (gint error);
gchar * g_win32_get_package_installation_directory (gchar *package, gchar* g_win32_get_package_installation_directory (gchar *package,
gchar *dll_name); gchar *dll_name);
gchar * g_win32_get_package_installation_subdirectory (gchar *package, gchar* g_win32_get_package_installation_subdirectory (gchar *package,
gchar *dll_name, gchar *dll_name,
gchar *subdir); gchar *subdir);

18
gmem.c
View File

@ -591,7 +591,7 @@ struct _GMemArea
struct _GRealMemChunk struct _GRealMemChunk
{ {
gchar *name; /* name of this MemChunk...used for debugging output */ const gchar *name; /* name of this MemChunk...used for debugging output */
gint type; /* the type of MemChunk: ALLOC_ONLY or ALLOC_AND_FREE */ gint type; /* the type of MemChunk: ALLOC_ONLY or ALLOC_AND_FREE */
gint num_mem_areas; /* the number of memory areas */ gint num_mem_areas; /* the number of memory areas */
gint num_marked_areas; /* the number of areas marked for deletion */ gint num_marked_areas; /* the number of areas marked for deletion */
@ -622,10 +622,10 @@ static GMutex *mem_chunks_lock = NULL;
static GRealMemChunk *mem_chunks = NULL; static GRealMemChunk *mem_chunks = NULL;
GMemChunk* GMemChunk*
g_mem_chunk_new (gchar *name, g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type) gint type)
{ {
GRealMemChunk *mem_chunk; GRealMemChunk *mem_chunk;
gulong rarea_size; gulong rarea_size;
@ -1135,10 +1135,10 @@ typedef struct {
} GMinimalMemChunk; } GMinimalMemChunk;
GMemChunk* GMemChunk*
g_mem_chunk_new (gchar *name, g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type) gint type)
{ {
GMinimalMemChunk *mem_chunk; GMinimalMemChunk *mem_chunk;

26
gmem.h
View File

@ -132,19 +132,19 @@ void g_mem_profile (void);
#define G_ALLOC_ONLY 1 #define G_ALLOC_ONLY 1
#define G_ALLOC_AND_FREE 2 #define G_ALLOC_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name, GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size, gint atom_size,
gulong area_size, gulong area_size,
gint type); gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk); void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk); gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk); gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk, void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem); gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk); void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk); void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk); void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void); void g_mem_chunk_info (void);
/* Ah yes...we have a "g_blow_chunks" function. /* Ah yes...we have a "g_blow_chunks" function.
* "g_blow_chunks" simply compresses all the chunks. This operation * "g_blow_chunks" simply compresses all the chunks. This operation

View File

@ -879,7 +879,7 @@ printf_string_upper_bound (const gchar *format,
GDoubleIEEE754 u_double; GDoubleIEEE754 u_double;
guint v_uint; guint v_uint;
gint v_int; gint v_int;
gchar *v_string; const gchar *v_string;
/* beware of positional parameters /* beware of positional parameters
*/ */

View File

@ -1,3 +1,10 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
Applied patch from Soeren Sandmann:
* gmodule.c (g_module_error): G_CONST_RETURN
(g_module_name): G_CONST_RETURN
Sat Feb 17 07:27:15 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:27:15 2001 Tim Janik <timj@gtk.org>
* gmodule.c: work around platforms that have broken RTLD_GLOBAL. * gmodule.c: work around platforms that have broken RTLD_GLOBAL.

View File

@ -477,7 +477,7 @@ g_module_make_resident (GModule *module)
module->is_resident = TRUE; module->is_resident = TRUE;
} }
gchar* G_CONST_RETURN gchar*
g_module_error (void) g_module_error (void)
{ {
return g_static_private_get (&module_error_private); return g_static_private_get (&module_error_private);
@ -488,7 +488,7 @@ g_module_symbol (GModule *module,
const gchar *symbol_name, const gchar *symbol_name,
gpointer *symbol) gpointer *symbol)
{ {
gchar *module_error; const gchar *module_error;
if (symbol) if (symbol)
*symbol = NULL; *symbol = NULL;
@ -527,7 +527,7 @@ g_module_symbol (GModule *module,
return !module_error; return !module_error;
} }
gchar* G_CONST_RETURN gchar*
g_module_name (GModule *module) g_module_name (GModule *module)
{ {
g_return_val_if_fail (module != NULL, NULL); g_return_val_if_fail (module != NULL, NULL);

View File

@ -58,26 +58,25 @@ typedef void (*GModuleUnload) (GModule *module);
gboolean g_module_supported (void) G_GNUC_CONST; gboolean g_module_supported (void) G_GNUC_CONST;
/* open a module `file_name' and return handle, which is NULL on error */ /* open a module `file_name' and return handle, which is NULL on error */
GModule* g_module_open (const gchar *file_name, GModule* g_module_open (const gchar *file_name,
GModuleFlags flags); GModuleFlags flags);
/* close a previously opened module, returns TRUE on success */ /* close a previously opened module, returns TRUE on success */
gboolean g_module_close (GModule *module); gboolean g_module_close (GModule *module);
/* make a module resident so g_module_close on it will be ignored */ /* make a module resident so g_module_close on it will be ignored */
void g_module_make_resident (GModule *module); void g_module_make_resident (GModule *module);
/* query the last module error as a string */ /* query the last module error as a string */
gchar* g_module_error (void); G_CONST_RETURN gchar* g_module_error (void);
/* retrive a symbol pointer from `module', returns TRUE on success */ /* retrive a symbol pointer from `module', returns TRUE on success */
gboolean g_module_symbol (GModule *module, gboolean g_module_symbol (GModule *module,
const gchar *symbol_name, const gchar *symbol_name,
gpointer *symbol); gpointer *symbol);
/* retrive the file name from an existing module */ /* retrive the file name from an existing module */
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 /* Build the actual file name containing a module. `directory' is the
* directory where the module file is supposed to be, or NULL or empty * directory where the module file is supposed to be, or NULL or empty
@ -90,8 +89,9 @@ gchar* g_module_name (GModule *module);
* *
* No checks are made that the file exists, or is of correct type. * No checks are made that the file exists, or is of correct type.
*/ */
gchar* g_module_build_path (const gchar *directory, gchar* g_module_build_path (const gchar *directory,
const gchar *module_name); const gchar *module_name);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,3 +1,15 @@
2001-02-17 Havoc Pennington <hp@pobox.com>
Applied patch from Soeren Sandmann:
* gvaluetypes.c (g_value_get_string): G_CONST_RETURN
* gtype.c (g_type_name): G_CONST_RETURN
* gsignal.c (g_signal_name): G_CONST_RETURN
* gobject-query.c (main): const fix
Sat Feb 17 07:58:46 2001 Tim Janik <timj@gtk.org> Sat Feb 17 07:58:46 2001 Tim Janik <timj@gtk.org>
* genums.h (G_TYPE_IS_FLAGS): patch from sven to fixup * genums.h (G_TYPE_IS_FLAGS): patch from sven to fixup

View File

@ -213,7 +213,7 @@ main (gint argc,
root = ~0; root = ~0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
gchar *name = g_type_name (i); const gchar *name = g_type_name (i);
if (name) if (name)
show_nodes (i, 0, iindent); show_nodes (i, 0, iindent);

View File

@ -813,7 +813,7 @@ g_signal_lookup (const gchar *name,
return signal_id; return signal_id;
} }
gchar* G_CONST_RETURN gchar*
g_signal_name (guint signal_id) g_signal_name (guint signal_id)
{ {
SignalNode *node; SignalNode *node;
@ -873,7 +873,7 @@ g_signal_list_ids (GType itype,
for (i = 0; i < n_nodes; i++) for (i = 0; i < n_nodes; i++)
if (keys[i].itype == itype) if (keys[i].itype == itype)
{ {
gchar *name = g_quark_to_string (keys[i].quark); const gchar *name = g_quark_to_string (keys[i].quark);
/* Signal names with "_" in them are aliases to the same /* Signal names with "_" in them are aliases to the same
* name with "-" instead of "_". * name with "-" instead of "_".

View File

@ -88,55 +88,56 @@ struct _GSignalQuery
/* --- signals --- */ /* --- signals --- */
guint g_signal_newv (const gchar *signal_name, guint g_signal_newv (const gchar *signal_name,
GType itype, GType itype,
GSignalFlags signal_flags, GSignalFlags signal_flags,
GClosure *class_closure, GClosure *class_closure,
GSignalAccumulator accumulator, GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller, GSignalCMarshaller c_marshaller,
GType return_type, GType return_type,
guint n_params, guint n_params,
GType *param_types); GType *param_types);
guint g_signal_new_valist (const gchar *signal_name, guint g_signal_new_valist (const gchar *signal_name,
GType itype, GType itype,
GSignalFlags signal_flags, GSignalFlags signal_flags,
GClosure *class_closure, GClosure *class_closure,
GSignalAccumulator accumulator, GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller, GSignalCMarshaller c_marshaller,
GType return_type, GType return_type,
guint n_params, guint n_params,
va_list args); va_list args);
guint g_signal_newc (const gchar *signal_name, guint g_signal_newc (const gchar *signal_name,
GType itype, GType itype,
GSignalFlags signal_flags, GSignalFlags signal_flags,
guint class_offset, guint class_offset,
GSignalAccumulator accumulator, GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller, GSignalCMarshaller c_marshaller,
GType return_type, GType return_type,
guint n_params, guint n_params,
...); ...);
void g_signal_emitv (const GValue *instance_and_params, void g_signal_emitv (const GValue *instance_and_params,
guint signal_id, guint signal_id,
GQuark detail, GQuark detail,
GValue *return_value); GValue *return_value);
void g_signal_emit_valist (gpointer instance, void g_signal_emit_valist (gpointer instance,
guint signal_id, guint signal_id,
GQuark detail, GQuark detail,
va_list var_args); va_list var_args);
void g_signal_emit (gpointer instance, void g_signal_emit (gpointer instance,
guint signal_id, guint signal_id,
GQuark detail, GQuark detail,
...); ...);
void g_signal_emit_by_name (gpointer instance, void g_signal_emit_by_name (gpointer instance,
const gchar *detailed_signal, const gchar *detailed_signal,
...); ...);
guint g_signal_lookup (const gchar *name, guint g_signal_lookup (const gchar *name,
GType itype); GType itype);
gchar* g_signal_name (guint signal_id); G_CONST_RETURN gchar* g_signal_name (guint signal_id);
void g_signal_query (guint signal_id, void g_signal_query (guint signal_id,
GSignalQuery *query); GSignalQuery *query);
guint* g_signal_list_ids (GType itype, guint* g_signal_list_ids (GType itype,
guint *n_ids); guint *n_ids);
/* --- signal emissions --- */ /* --- signal emissions --- */
void g_signal_stop_emission (gpointer instance, void g_signal_stop_emission (gpointer instance,

View File

@ -68,7 +68,7 @@ static GStaticRWLock type_rw_lock = G_STATIC_RW_LOCK_INIT;
#define G_WRITE_UNLOCK(rw_lock) g_static_rw_lock_writer_unlock (rw_lock) #define G_WRITE_UNLOCK(rw_lock) g_static_rw_lock_writer_unlock (rw_lock)
#define INVALID_RECURSION(func, arg, type_name) G_STMT_START{ \ #define INVALID_RECURSION(func, arg, type_name) G_STMT_START{ \
static const gchar *_action = " invalidly modified type "; \ static const gchar *_action = " invalidly modified type "; \
gpointer _arg = (gpointer) (arg); gchar *_tname = (type_name), *_fname = (func); \ gpointer _arg = (gpointer) (arg); const gchar *_tname = (type_name), *_fname = (func); \
if (_arg) \ if (_arg) \
g_error ("%s(%p)%s`%s'", _fname, _arg, _action, _tname); \ g_error ("%s(%p)%s`%s'", _fname, _arg, _action, _tname); \
else \ else \
@ -145,7 +145,7 @@ struct _TypeNode
#define MAX_N_IFACES (511) #define MAX_N_IFACES (511)
#define NODE_TYPE(node) (node->supers[0]) #define NODE_TYPE(node) (node->supers[0])
#define NODE_PARENT_TYPE(node) (node->supers[1]) #define NODE_PARENT_TYPE(node) (node->supers[1])
#define NODE_NAME(node) (g_quark_to_string (node->qname)) #define NODE_NAME(node) ((gchar*)g_quark_to_string (node->qname))
struct _IFaceHolder struct _IFaceHolder
{ {
@ -431,13 +431,13 @@ type_descriptive_name_L (GType type)
static inline gchar* static inline gchar*
type_descriptive_name_U (GType type) type_descriptive_name_U (GType type)
{ {
gchar *name; const gchar *name;
G_READ_LOCK (&type_rw_lock); G_READ_LOCK (&type_rw_lock);
name = type_descriptive_name_L (type); name = type_descriptive_name_L (type);
G_READ_UNLOCK (&type_rw_lock); G_READ_UNLOCK (&type_rw_lock);
return name; return (gchar *)name;
} }
@ -1816,7 +1816,7 @@ g_type_value_table_peek (GType type)
return vtable; return vtable;
} }
gchar* G_CONST_RETURN gchar*
g_type_name (GType type) g_type_name (GType type)
{ {
TypeNode *node; TypeNode *node;
@ -2409,7 +2409,7 @@ g_type_init (GTypeDebugFlags debug_flags)
{ {
G_LOCK_DEFINE_STATIC (type_init_lock); G_LOCK_DEFINE_STATIC (type_init_lock);
static TypeNode *type0_node = NULL; static TypeNode *type0_node = NULL;
gchar *env_string; const gchar *env_string;
GTypeInfo info; GTypeInfo info;
TypeNode *node; TypeNode *node;
GType type; GType type;

View File

@ -179,33 +179,35 @@ typedef enum /*< skip >*/
/* --- prototypes --- */ /* --- prototypes --- */
void g_type_init (GTypeDebugFlags debug_flags); void g_type_init (GTypeDebugFlags debug_flags);
gchar* g_type_name (GType type); G_CONST_RETURN gchar* g_type_name (GType type);
GQuark g_type_qname (GType type); GQuark g_type_qname (GType type);
GType g_type_from_name (const gchar *name); GType g_type_from_name (const gchar *name);
GType g_type_parent (GType type); GType g_type_parent (GType type);
GType g_type_next_base (GType type, GType g_type_next_base (GType type,
GType base_type); GType base_type);
gboolean g_type_is_a (GType type, gboolean g_type_is_a (GType type,
GType is_a_type); GType is_a_type);
guint g_type_fundamental_branch_last (GType type); guint g_type_fundamental_branch_last (GType type);
gpointer g_type_class_ref (GType type); gpointer g_type_class_ref (GType type);
gpointer g_type_class_peek (GType type); gpointer g_type_class_peek (GType type);
void g_type_class_unref (gpointer g_class); void g_type_class_unref (gpointer g_class);
gpointer g_type_class_peek_parent (gpointer g_class); gpointer g_type_class_peek_parent (gpointer g_class);
gpointer g_type_interface_peek (gpointer instance_class, gpointer g_type_interface_peek (gpointer instance_class,
GType iface_type); GType iface_type);
/* g_free() the returned arrays */ /* g_free() the returned arrays */
GType* g_type_children (GType type, GType* g_type_children (GType type,
guint *n_children); guint *n_children);
GType* g_type_interfaces (GType type, GType* g_type_interfaces (GType type,
guint *n_interfaces); guint *n_interfaces);
/* per-type _static_ data */ /* per-type _static_ data */
void g_type_set_qdata (GType type, void g_type_set_qdata (GType type,
GQuark quark, GQuark quark,
gpointer data); gpointer data);
gpointer g_type_get_qdata (GType type, gpointer g_type_get_qdata (GType type,
GQuark quark); GQuark quark);
/* --- type registration --- */ /* --- type registration --- */

View File

@ -735,7 +735,7 @@ g_value_set_static_string (GValue *value,
value->data[0].v_pointer = (gchar*) v_string; value->data[0].v_pointer = (gchar*) v_string;
} }
gchar* G_CONST_RETURN gchar*
g_value_get_string (const GValue *value) g_value_get_string (const GValue *value)
{ {
g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL); g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL);

View File

@ -46,51 +46,48 @@ extern "C" {
/* --- prototypes --- */ /* --- prototypes --- */
void g_value_set_char (GValue *value, void g_value_set_char (GValue *value,
gint8 v_char); gint8 v_char);
gint8 g_value_get_char (const GValue *value); gint8 g_value_get_char (const GValue *value);
void g_value_set_uchar (GValue *value, void g_value_set_uchar (GValue *value,
guint8 v_uchar); guint8 v_uchar);
guint8 g_value_get_uchar (const GValue *value); guint8 g_value_get_uchar (const GValue *value);
void g_value_set_boolean (GValue *value, void g_value_set_boolean (GValue *value,
gboolean v_boolean); gboolean v_boolean);
gboolean g_value_get_boolean (const GValue *value); gboolean g_value_get_boolean (const GValue *value);
void g_value_set_int (GValue *value, void g_value_set_int (GValue *value,
gint v_int); gint v_int);
gint g_value_get_int (const GValue *value); gint g_value_get_int (const GValue *value);
void g_value_set_uint (GValue *value, void g_value_set_uint (GValue *value,
guint v_uint); guint v_uint);
guint g_value_get_uint (const GValue *value); guint g_value_get_uint (const GValue *value);
void g_value_set_long (GValue *value, void g_value_set_long (GValue *value,
glong v_long); glong v_long);
glong g_value_get_long (const GValue *value); glong g_value_get_long (const GValue *value);
void g_value_set_ulong (GValue *value, void g_value_set_ulong (GValue *value,
gulong v_ulong); gulong v_ulong);
gulong g_value_get_ulong (const GValue *value); gulong g_value_get_ulong (const GValue *value);
void g_value_set_float (GValue *value, void g_value_set_float (GValue *value,
gfloat v_float); gfloat v_float);
gfloat g_value_get_float (const GValue *value); gfloat g_value_get_float (const GValue *value);
void g_value_set_double (GValue *value, void g_value_set_double (GValue *value,
gdouble v_double); gdouble v_double);
gdouble g_value_get_double (const GValue *value); gdouble g_value_get_double (const GValue *value);
void g_value_set_string (GValue *value, void g_value_set_string (GValue *value,
const gchar *v_string); const gchar *v_string);
void g_value_set_static_string (GValue *value, void g_value_set_static_string (GValue *value,
const gchar *v_string); const gchar *v_string);
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); gchar* g_value_dup_string (const GValue *value);
void g_value_set_pointer (GValue *value, void g_value_set_pointer (GValue *value,
gpointer v_pointer); gpointer v_pointer);
gpointer g_value_get_pointer (const GValue *value); gpointer g_value_get_pointer (const GValue *value);
void g_value_set_ccallback (GValue *value, void g_value_set_ccallback (GValue *value,
gpointer callback_func, gpointer callback_func,
gpointer callback_data); gpointer callback_data);
void g_value_get_ccallback (const GValue *value, void g_value_get_ccallback (const GValue *value,
gpointer *callback_func, gpointer *callback_func,
gpointer *callback_data); gpointer *callback_data);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -35,10 +35,10 @@ typedef guint32 GQuark;
/* Quarks (string<->id association) /* Quarks (string<->id association)
*/ */
GQuark g_quark_try_string (const gchar *string); GQuark g_quark_try_string (const gchar *string);
GQuark g_quark_from_static_string (const gchar *string); GQuark g_quark_from_static_string (const gchar *string);
GQuark g_quark_from_string (const gchar *string); GQuark g_quark_from_string (const gchar *string);
gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST; G_CONST_RETURN gchar* g_quark_to_string (GQuark quark) G_GNUC_CONST;
G_END_DECLS G_END_DECLS

View File

@ -1288,7 +1288,8 @@ g_execute (const gchar *file,
else else
{ {
gboolean got_eacces = 0; gboolean got_eacces = 0;
char *path, *p, *name, *freeme; const gchar *path, *p;
gchar *name, *freeme;
size_t len; size_t len;
size_t pathlen; size_t pathlen;

View File

@ -226,7 +226,7 @@ g_strtod (const gchar *nptr,
} }
} }
gchar* G_CONST_RETURN gchar*
g_strerror (gint errnum) g_strerror (gint errnum)
{ {
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
@ -669,7 +669,7 @@ g_strerror (gint errnum)
return msg; return msg;
} }
gchar* G_CONST_RETURN gchar*
g_strsignal (gint signum) g_strsignal (gint signum)
{ {
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT; static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;

View File

@ -36,58 +36,58 @@ G_BEGIN_DECLS
* return a constant string that must not be freed. * return a constant string that must not be freed.
*/ */
#define G_STR_DELIMITERS "_-|> <." #define G_STR_DELIMITERS "_-|> <."
gchar* g_strdelimit (gchar *string, gchar* g_strdelimit (gchar *string,
const gchar *delimiters, const gchar *delimiters,
gchar new_delimiter); gchar new_delimiter);
gchar* g_strcanon (gchar *string, gchar* g_strcanon (gchar *string,
const gchar *valid_chars, const gchar *valid_chars,
gchar subsitutor); gchar subsitutor);
gdouble g_strtod (const gchar *nptr, gdouble g_strtod (const gchar *nptr,
gchar **endptr); gchar **endptr);
gchar* g_strerror (gint errnum) G_GNUC_CONST; G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
gchar* g_strsignal (gint signum) G_GNUC_CONST; G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1, gint g_strcasecmp (const gchar *s1,
const gchar *s2); const gchar *s2);
gint g_strncasecmp (const gchar *s1, gint g_strncasecmp (const gchar *s1,
const gchar *s2, const gchar *s2,
guint n); guint n);
gchar* g_strdown (gchar *string); gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string); gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string); gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest, gsize g_strlcpy (gchar *dest,
const gchar *src, const gchar *src,
gsize dest_size); gsize dest_size);
gsize g_strlcat (gchar *dest, gsize g_strlcat (gchar *dest,
const gchar *src, const gchar *src,
gsize dest_size); gsize dest_size);
/* removes leading spaces */ /* removes leading spaces */
gchar* g_strchug (gchar *string); gchar* g_strchug (gchar *string);
/* removes trailing spaces */ /* removes trailing spaces */
gchar* g_strchomp (gchar *string); gchar* g_strchomp (gchar *string);
/* removes leading & trailing spaces */ /* removes leading & trailing spaces */
#define g_strstrip( string ) g_strchomp (g_strchug (string)) #define g_strstrip( string ) g_strchomp (g_strchug (string))
/* String utility functions that return a newly allocated string which /* String utility functions that return a newly allocated string which
* ought to be freed with g_free from the caller at some point. * 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);
gchar* g_strdup_printf (const gchar *format, gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2); ...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format, gchar* g_strdup_vprintf (const gchar *format,
va_list args); va_list args);
gchar* g_strndup (const gchar *str, gchar* g_strndup (const gchar *str,
guint n); guint n);
gchar* g_strnfill (guint length, gchar* g_strnfill (guint length,
gchar fill_char); gchar fill_char);
gchar* g_strconcat (const gchar *string1, gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */ ...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator, gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */ ...); /* NULL terminated */
/* Make a copy of a string interpreting C string -style escape /* Make a copy of a string interpreting C string -style escape
* sequences. Inverse of g_strescape. The recognized sequences are \b * sequences. Inverse of g_strescape. The recognized sequences are \b
* \f \n \r \t \\ \" and the octal format. * \f \n \r \t \\ \" and the octal format.
*/ */
gchar* g_strcompress (const gchar *source); gchar* g_strcompress (const gchar *source);
/* Copy a string escaping nonprintable characters like in C strings. /* Copy a string escaping nonprintable characters like in C strings.
* Inverse of g_strcompress. The exceptions parameter, if non-NULL, points * Inverse of g_strcompress. The exceptions parameter, if non-NULL, points
@ -97,11 +97,11 @@ gchar* g_strcompress (const gchar *source);
* Luckily this function wasn't used much, using NULL as second parameter * Luckily this function wasn't used much, using NULL as second parameter
* provides mostly identical semantics. * provides mostly identical semantics.
*/ */
gchar* g_strescape (const gchar *source, gchar* g_strescape (const gchar *source,
const gchar *exceptions); const gchar *exceptions);
gpointer g_memdup (gconstpointer mem, gpointer g_memdup (gconstpointer mem,
guint byte_size); guint byte_size);
/* NULL terminated string arrays. /* NULL terminated string arrays.
* g_strsplit() splits up string into max_tokens tokens at delim and * g_strsplit() splits up string into max_tokens tokens at delim and
@ -111,13 +111,13 @@ gpointer g_memdup (gconstpointer mem,
* g_strfreev() frees the array itself and all of its strings. * g_strfreev() frees the array itself and all of its strings.
* g_strdupv() copies a NULL-terminated array of strings * g_strdupv() copies a NULL-terminated array of strings
*/ */
gchar** g_strsplit (const gchar *string, gchar** g_strsplit (const gchar *string,
const gchar *delimiter, const gchar *delimiter,
gint max_tokens); gint max_tokens);
gchar* g_strjoinv (const gchar *separator, gchar* g_strjoinv (const gchar *separator,
gchar **str_array); gchar **str_array);
void g_strfreev (gchar **str_array); void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array); gchar** g_strdupv (gchar **str_array);
G_END_DECLS G_END_DECLS

View File

@ -46,6 +46,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <string.h>
#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P #if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
# define g_system_thread_equal(thread1, thread2) \ # define g_system_thread_equal(thread1, thread2) \
(thread1.dummy_pointer == thread2.dummy_pointer) (thread1.dummy_pointer == thread2.dummy_pointer)

View File

@ -180,30 +180,30 @@ GLIB_VAR char g_utf8_skip[256];
#define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)]) #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)])
gunichar g_utf8_get_char (const gchar *p); gunichar g_utf8_get_char (const gchar *p);
gchar * g_utf8_offset_to_pointer (const gchar *str, gchar* g_utf8_offset_to_pointer (const gchar *str,
gint offset); gint offset);
gint g_utf8_pointer_to_offset (const gchar *str, gint g_utf8_pointer_to_offset (const gchar *str,
const gchar *pos); const gchar *pos);
gchar * g_utf8_prev_char (const gchar *p); gchar* g_utf8_prev_char (const gchar *p);
gchar * g_utf8_find_next_char (const gchar *p, gchar* g_utf8_find_next_char (const gchar *p,
const gchar *end); const gchar *end);
gchar * g_utf8_find_prev_char (const gchar *str, gchar* g_utf8_find_prev_char (const gchar *str,
const gchar *p); const gchar *p);
gint g_utf8_strlen (const gchar *p, gint g_utf8_strlen (const gchar *p,
gint max); gint max);
/* Copies n characters from src to dest */ /* Copies n characters from src to dest */
gchar *g_utf8_strncpy (gchar *dest, gchar* g_utf8_strncpy (gchar *dest,
const gchar *src, const gchar *src,
size_t n); size_t n);
/* Find the UTF-8 character corresponding to ch, in string p. These /* Find the UTF-8 character corresponding to ch, in string p. These
functions are equivalants to strchr and strrchr */ functions are equivalants to strchr and strrchr */
gchar *g_utf8_strchr (const gchar *p, gchar* g_utf8_strchr (const gchar *p,
gunichar c); gunichar c);
gchar *g_utf8_strrchr (const gchar *p, gchar* g_utf8_strrchr (const gchar *p,
gunichar c); gunichar c);
gunichar2 *g_utf8_to_utf16 (const gchar *str, gunichar2 *g_utf8_to_utf16 (const gchar *str,
@ -224,7 +224,7 @@ gunichar * g_utf16_to_ucs4 (const gunichar2 *str,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
GError **error); GError **error);
gchar * g_utf16_to_utf8 (const gunichar2 *str, gchar* g_utf16_to_utf8 (const gunichar2 *str,
gint len, gint len,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
@ -234,7 +234,7 @@ gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,
GError **error); GError **error);
gchar * g_ucs4_to_utf8 (const gunichar *str, gchar* g_ucs4_to_utf8 (const gunichar *str,
gint len, gint len,
gint *items_read, gint *items_read,
gint *items_written, gint *items_written,

View File

@ -111,7 +111,7 @@ void
g_atexit (GVoidFunc func) g_atexit (GVoidFunc func)
{ {
gint result; gint result;
gchar *error = NULL; const gchar *error = NULL;
/* keep this in sync with glib.h */ /* keep this in sync with glib.h */
@ -171,7 +171,8 @@ my_strchrnul (const gchar *str, gchar c)
gchar* gchar*
g_find_program_in_path (const gchar *program) g_find_program_in_path (const gchar *program)
{ {
gchar *path, *p, *name, *freeme; const gchar *path, *p;
gchar *name, *freeme;
size_t len; size_t len;
size_t pathlen; size_t pathlen;
@ -373,7 +374,7 @@ g_parse_debug_string (const gchar *string,
return result; return result;
} }
gchar* G_CONST_RETURN gchar*
g_basename (const gchar *file_name) g_basename (const gchar *file_name)
{ {
register gchar *base; register gchar *base;
@ -465,8 +466,8 @@ g_path_is_absolute (const gchar *file_name)
return FALSE; return FALSE;
} }
gchar* G_CONST_RETURN gchar*
g_path_skip_root (gchar *file_name) g_path_skip_root (const gchar *file_name)
{ {
g_return_val_if_fail (file_name != NULL, NULL); g_return_val_if_fail (file_name != NULL, NULL);
@ -490,7 +491,7 @@ g_path_skip_root (gchar *file_name)
if (file_name[0] == G_DIR_SEPARATOR) if (file_name[0] == G_DIR_SEPARATOR)
file_name++; file_name++;
return file_name; return (gchar *)file_name;
} }
} }
#endif #endif
@ -500,13 +501,13 @@ g_path_skip_root (gchar *file_name)
{ {
while (file_name[0] == G_DIR_SEPARATOR) while (file_name[0] == G_DIR_SEPARATOR)
file_name++; file_name++;
return file_name; return (gchar *)file_name;
} }
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* Skip X:\ */ /* Skip X:\ */
if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR) if (isalpha (file_name[0]) && file_name[1] == ':' && file_name[2] == G_DIR_SEPARATOR)
return file_name + 3; return (gchar *)file_name + 3;
#endif #endif
return NULL; return NULL;
@ -597,7 +598,7 @@ g_get_current_dir (void)
return dir; return dir;
} }
gchar* G_CONST_RETURN gchar*
g_getenv (const gchar *variable) g_getenv (const gchar *variable)
{ {
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
@ -864,7 +865,7 @@ g_get_any_init (void)
} }
} }
gchar* G_CONST_RETURN gchar*
g_get_user_name (void) g_get_user_name (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -875,7 +876,7 @@ g_get_user_name (void)
return g_user_name; return g_user_name;
} }
gchar* G_CONST_RETURN gchar*
g_get_real_name (void) g_get_real_name (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -892,7 +893,7 @@ g_get_real_name (void)
* deduced, return NULL. * deduced, return NULL.
*/ */
gchar* G_CONST_RETURN gchar*
g_get_home_dir (void) g_get_home_dir (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -910,7 +911,7 @@ g_get_home_dir (void)
* and C:\ on Windows. * and C:\ on Windows.
*/ */
gchar* G_CONST_RETURN gchar*
g_get_tmp_dir (void) g_get_tmp_dir (void)
{ {
G_LOCK (g_utils_global); G_LOCK (g_utils_global);
@ -1014,7 +1015,7 @@ g_get_codeset (void)
#endif /* G_OS_WIN32 */ #endif /* G_OS_WIN32 */
gchar * G_CONST_RETURN gchar *
_glib_gettext (const gchar *str) _glib_gettext (const gchar *str)
{ {
gboolean _glib_gettext_initialized = FALSE; gboolean _glib_gettext_initialized = FALSE;

View File

@ -113,12 +113,12 @@ G_BEGIN_DECLS
/* Retrive static string info /* Retrive static string info
*/ */
gchar* g_get_user_name (void); G_CONST_RETURN gchar* g_get_user_name (void);
gchar* g_get_real_name (void); G_CONST_RETURN gchar* g_get_real_name (void);
gchar* g_get_home_dir (void); G_CONST_RETURN gchar* g_get_home_dir (void);
gchar* g_get_tmp_dir (void); G_CONST_RETURN gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void); gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname); void g_set_prgname (const gchar *prgname);
typedef struct _GDebugKey GDebugKey; typedef struct _GDebugKey GDebugKey;
@ -130,40 +130,42 @@ struct _GDebugKey
/* Miscellaneous utility functions /* Miscellaneous utility functions
*/ */
guint g_parse_debug_string (const gchar *string, guint g_parse_debug_string (const gchar *string,
GDebugKey *keys, GDebugKey *keys,
guint nkeys); guint nkeys);
gint g_snprintf (gchar *string, gint g_snprintf (gchar *string,
gulong n, gulong n,
gchar const *format, gchar const *format,
...) G_GNUC_PRINTF (3, 4); ...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string, gint g_vsnprintf (gchar *string,
gulong n, gulong n,
gchar const *format, gchar const *format,
va_list args); va_list args);
/* Check if a file name is an absolute path */ /* Check if a file name is an absolute path */
gboolean g_path_is_absolute (const gchar *file_name); gboolean g_path_is_absolute (const gchar *file_name);
/* In case of absolute paths, skip the root part */ /* In case of absolute paths, skip the root part */
gchar* g_path_skip_root (gchar *file_name); G_CONST_RETURN gchar* g_path_skip_root (const gchar *file_name);
/* These two functions are deprecated and will be removed in the next /* These two functions are deprecated and will be removed in the next
* major release of GLib. Use g_path_get_dirname/g_path_get_basename * major release of GLib. Use g_path_get_dirname/g_path_get_basename
* instead. Whatch out! The string returned by 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.*/ * must be g_freed, while the string returned by g_basename must not.*/
gchar* g_basename (const gchar *file_name); G_CONST_RETURN gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name); gchar* g_dirname (const gchar *file_name);
/* The returned strings are newly allocated with g_malloc() */ /* The returned strings are newly allocated with g_malloc() */
gchar* g_get_current_dir (void); gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name); gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name); gchar* g_path_get_dirname (const gchar *file_name);
/* Get the codeset for the current locale */ /* Get the codeset for the current locale */
/* gchar * g_get_codeset (void); */ /* gchar * g_get_codeset (void); */
/* return the environment string for the variable. The returned memory /* return the environment string for the variable. The returned memory
* must not be freed. */ * must not be freed. */
gchar* g_getenv (const gchar *variable); G_CONST_RETURN gchar* g_getenv (const gchar *variable);
/* we try to provide a usefull equivalent for ATEXIT if it is /* we try to provide a usefull equivalent for ATEXIT if it is

View File

@ -102,18 +102,18 @@ gint g_win32_closedir (DIR *dir);
* returns it as a string of the above form for use in forming file * returns it as a string of the above form for use in forming file
* names etc. The returned string should be deallocated with g_free(). * names etc. The returned string should be deallocated with g_free().
*/ */
gchar * g_win32_getlocale (void); gchar* g_win32_getlocale (void);
/* Translate a Win32 error code (as returned by GetLastError()) into /* Translate a Win32 error code (as returned by GetLastError()) into
* the corresponding message. The returned string should be deallocated * the corresponding message. The returned string should be deallocated
* with g_free(). * with g_free().
*/ */
gchar * g_win32_error_message (gint error); gchar* g_win32_error_message (gint error);
gchar * g_win32_get_package_installation_directory (gchar *package, gchar* g_win32_get_package_installation_directory (gchar *package,
gchar *dll_name); gchar *dll_name);
gchar * g_win32_get_package_installation_subdirectory (gchar *package, gchar* g_win32_get_package_installation_subdirectory (gchar *package,
gchar *dll_name, gchar *dll_name,
gchar *subdir); gchar *subdir);

View File

@ -445,7 +445,7 @@ main (int argc,
g_print ("checking g_path_skip_root()..."); g_print ("checking g_path_skip_root()...");
for (i = 0; i < n_skip_root_checks; i++) for (i = 0; i < n_skip_root_checks; i++)
{ {
gchar *skipped; const gchar *skipped;
skipped = g_path_skip_root (skip_root_checks[i].filename); skipped = g_path_skip_root (skip_root_checks[i].filename);
if ((skipped && !skip_root_checks[i].without_root) || if ((skipped && !skip_root_checks[i].without_root) ||

View File

@ -445,7 +445,7 @@ main (int argc,
g_print ("checking g_path_skip_root()..."); g_print ("checking g_path_skip_root()...");
for (i = 0; i < n_skip_root_checks; i++) for (i = 0; i < n_skip_root_checks; i++)
{ {
gchar *skipped; const gchar *skipped;
skipped = g_path_skip_root (skip_root_checks[i].filename); skipped = g_path_skip_root (skip_root_checks[i].filename);
if ((skipped && !skip_root_checks[i].without_root) || if ((skipped && !skip_root_checks[i].without_root) ||