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,7 +622,7 @@ 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)
@ -1135,7 +1135,7 @@ 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)

View File

@ -132,7 +132,7 @@ 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);

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

@ -38,7 +38,7 @@ typedef guint32 GQuark;
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

@ -44,8 +44,8 @@ gchar* g_strcanon (gchar *string,
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,

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,10 +113,10 @@ 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);
@ -141,16 +141,18 @@ 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() */
@ -163,7 +165,7 @@ gchar* g_path_get_dirname (const gchar *file_name);
/* 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);

6
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,7 +622,7 @@ 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)
@ -1135,7 +1135,7 @@ 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)

2
gmem.h
View File

@ -132,7 +132,7 @@ 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);

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

@ -68,7 +68,7 @@ gboolean g_module_close (GModule *module);
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,
@ -76,8 +76,7 @@ gboolean g_module_symbol (GModule *module,
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
@ -93,6 +92,7 @@ gchar* g_module_name (GModule *module);
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
} }
#endif /* __cplusplus */ #endif /* __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

@ -132,12 +132,13 @@ void g_signal_emit_by_name (gpointer instance,
...); ...);
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,
guint signal_id, guint signal_id,

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

@ -180,7 +180,7 @@ 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);
@ -195,11 +195,13 @@ 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,

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

@ -77,7 +77,7 @@ 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);
@ -89,9 +89,6 @@ void g_value_get_ccallback (const GValue *value,
gpointer *callback_func, gpointer *callback_func,
gpointer *callback_data); gpointer *callback_data);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -38,7 +38,7 @@ typedef guint32 GQuark;
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

@ -44,8 +44,8 @@ gchar* g_strcanon (gchar *string,
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,

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,10 +113,10 @@ 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);
@ -141,16 +141,18 @@ 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() */
@ -163,7 +165,7 @@ gchar* g_path_get_dirname (const gchar *file_name);
/* 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) ||