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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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;
}
gchar*
G_CONST_RETURN gchar*
g_quark_to_string (GQuark quark)
{
gchar* result = NULL;

View File

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

View File

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

View File

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

View File

@ -591,7 +591,7 @@ struct _GMemArea
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 num_mem_areas; /* the number of memory areas */
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;
GMemChunk*
g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type)
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
{
GRealMemChunk *mem_chunk;
gulong rarea_size;
@ -705,8 +705,8 @@ g_mem_chunk_destroy (GMemChunk *mem_chunk)
g_mutex_unlock (mem_chunks_lock);
if (rmem_chunk->type == G_ALLOC_AND_FREE)
g_tree_destroy (rmem_chunk->mem_tree);
g_tree_destroy (rmem_chunk->mem_tree);
g_free (rmem_chunk);
LEAVE_MEM_CHUNK_ROUTINE ();
@ -1135,10 +1135,10 @@ typedef struct {
} GMinimalMemChunk;
GMemChunk*
g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type)
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
{
GMinimalMemChunk *mem_chunk;

View File

@ -132,19 +132,19 @@ void g_mem_profile (void);
#define G_ALLOC_ONLY 1
#define G_ALLOC_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void);
GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void);
/* Ah yes...we have a "g_blow_chunks" function.
* "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;
guint v_uint;
gint v_int;
gchar *v_string;
const gchar *v_string;
/* beware of positional parameters
*/

View File

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

View File

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

View File

@ -226,7 +226,7 @@ g_strtod (const gchar *nptr,
}
}
gchar*
G_CONST_RETURN gchar*
g_strerror (gint errnum)
{
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
@ -669,7 +669,7 @@ g_strerror (gint errnum)
return msg;
}
gchar*
G_CONST_RETURN gchar*
g_strsignal (gint signum)
{
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.
*/
#define G_STR_DELIMITERS "_-|> <."
gchar* g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strcanon (gchar *string,
const gchar *valid_chars,
gchar subsitutor);
gdouble g_strtod (const gchar *nptr,
gchar **endptr);
gchar* g_strerror (gint errnum) G_GNUC_CONST;
gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
gint g_strncasecmp (const gchar *s1,
const gchar *s2,
guint n);
gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest,
const gchar *src,
gsize dest_size);
gsize g_strlcat (gchar *dest,
const gchar *src,
gsize dest_size);
gchar* g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strcanon (gchar *string,
const gchar *valid_chars,
gchar subsitutor);
gdouble g_strtod (const gchar *nptr,
gchar **endptr);
G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
gint g_strncasecmp (const gchar *s1,
const gchar *s2,
guint n);
gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest,
const gchar *src,
gsize dest_size);
gsize g_strlcat (gchar *dest,
const gchar *src,
gsize dest_size);
/* removes leading spaces */
gchar* g_strchug (gchar *string);
gchar* g_strchug (gchar *string);
/* removes trailing spaces */
gchar* g_strchomp (gchar *string);
gchar* g_strchomp (gchar *string);
/* removes leading & trailing spaces */
#define g_strstrip( string ) g_strchomp (g_strchug (string))
/* String utility functions that return a newly allocated string which
* ought to be freed with g_free from the caller at some point.
*/
gchar* g_strdup (const gchar *str);
gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format,
va_list args);
gchar* g_strndup (const gchar *str,
guint n);
gchar* g_strnfill (guint length,
gchar fill_char);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
gchar* g_strdup (const gchar *str);
gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format,
va_list args);
gchar* g_strndup (const gchar *str,
guint n);
gchar* g_strnfill (guint length,
gchar fill_char);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
/* Make a copy of a string interpreting C string -style escape
* sequences. Inverse of g_strescape. The recognized sequences are \b
* \f \n \r \t \\ \" and the octal format.
*/
gchar* g_strcompress (const gchar *source);
gchar* g_strcompress (const gchar *source);
/* Copy a string escaping nonprintable characters like in C strings.
* 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
* provides mostly identical semantics.
*/
gchar* g_strescape (const gchar *source,
const gchar *exceptions);
gchar* g_strescape (const gchar *source,
const gchar *exceptions);
gpointer g_memdup (gconstpointer mem,
guint byte_size);
gpointer g_memdup (gconstpointer mem,
guint byte_size);
/* NULL terminated string arrays.
* 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_strdupv() copies a NULL-terminated array of strings
*/
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gint max_tokens);
gchar* g_strjoinv (const gchar *separator,
gchar **str_array);
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gint max_tokens);
gchar* g_strjoinv (const gchar *separator,
gchar **str_array);
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
G_END_DECLS

View File

@ -46,6 +46,8 @@
#include <unistd.h>
#endif
#include <string.h>
#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
# define g_system_thread_equal(thread1, thread2) \
(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)])
gunichar g_utf8_get_char (const gchar *p);
gchar * g_utf8_offset_to_pointer (const gchar *str,
gint offset);
gchar* g_utf8_offset_to_pointer (const gchar *str,
gint offset);
gint g_utf8_pointer_to_offset (const gchar *str,
const gchar *pos);
gchar * g_utf8_prev_char (const gchar *p);
gchar * g_utf8_find_next_char (const gchar *p,
gchar* g_utf8_prev_char (const gchar *p);
gchar* g_utf8_find_next_char (const gchar *p,
const gchar *end);
gchar * g_utf8_find_prev_char (const gchar *str,
gchar* g_utf8_find_prev_char (const gchar *str,
const gchar *p);
gint g_utf8_strlen (const gchar *p,
gint max);
/* Copies n characters from src to dest */
gchar *g_utf8_strncpy (gchar *dest,
gchar* g_utf8_strncpy (gchar *dest,
const gchar *src,
size_t n);
/* Find the UTF-8 character corresponding to ch, in string p. These
functions are equivalants to strchr and strrchr */
gchar *g_utf8_strchr (const gchar *p,
gchar* g_utf8_strchr (const gchar *p,
gunichar c);
gchar *g_utf8_strrchr (const gchar *p,
gchar* g_utf8_strrchr (const gchar *p,
gunichar c);
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_written,
GError **error);
gchar * g_utf16_to_utf8 (const gunichar2 *str,
gchar* g_utf16_to_utf8 (const gunichar2 *str,
gint len,
gint *items_read,
gint *items_written,
@ -234,7 +234,7 @@ gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
gint *items_read,
gint *items_written,
GError **error);
gchar * g_ucs4_to_utf8 (const gunichar *str,
gchar* g_ucs4_to_utf8 (const gunichar *str,
gint len,
gint *items_read,
gint *items_written,

View File

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

View File

@ -113,12 +113,12 @@ G_BEGIN_DECLS
/* Retrive static string info
*/
gchar* g_get_user_name (void);
gchar* g_get_real_name (void);
gchar* g_get_home_dir (void);
gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname);
G_CONST_RETURN gchar* g_get_user_name (void);
G_CONST_RETURN gchar* g_get_real_name (void);
G_CONST_RETURN gchar* g_get_home_dir (void);
G_CONST_RETURN gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname);
typedef struct _GDebugKey GDebugKey;
@ -130,40 +130,42 @@ struct _GDebugKey
/* Miscellaneous utility functions
*/
guint g_parse_debug_string (const gchar *string,
GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string,
gulong n,
gchar const *format,
va_list args);
guint g_parse_debug_string (const gchar *string,
GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string,
gulong n,
gchar const *format,
va_list args);
/* 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 */
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
* major release of GLib. Use g_path_get_dirname/g_path_get_basename
* instead. Whatch out! The string returned by g_path_get_basename
* must be g_freed, while the string returned by g_basename must not.*/
gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name);
G_CONST_RETURN gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name);
/* The returned strings are newly allocated with g_malloc() */
gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name);
gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name);
/* Get the codeset for the current locale */
/* gchar * g_get_codeset (void); */
/* return the environment string for the variable. The returned memory
* 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

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
* 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
* the corresponding message. The returned string should be deallocated
* 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 * g_win32_get_package_installation_subdirectory (gchar *package,
gchar* g_win32_get_package_installation_subdirectory (gchar *package,
gchar *dll_name,
gchar *subdir);

22
gmem.c
View File

@ -591,7 +591,7 @@ struct _GMemArea
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 num_mem_areas; /* the number of memory areas */
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;
GMemChunk*
g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type)
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
{
GRealMemChunk *mem_chunk;
gulong rarea_size;
@ -705,8 +705,8 @@ g_mem_chunk_destroy (GMemChunk *mem_chunk)
g_mutex_unlock (mem_chunks_lock);
if (rmem_chunk->type == G_ALLOC_AND_FREE)
g_tree_destroy (rmem_chunk->mem_tree);
g_tree_destroy (rmem_chunk->mem_tree);
g_free (rmem_chunk);
LEAVE_MEM_CHUNK_ROUTINE ();
@ -1135,10 +1135,10 @@ typedef struct {
} GMinimalMemChunk;
GMemChunk*
g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type)
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
{
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_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name,
gint atom_size,
gulong area_size,
gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void);
GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type);
void g_mem_chunk_destroy (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc (GMemChunk *mem_chunk);
gpointer g_mem_chunk_alloc0 (GMemChunk *mem_chunk);
void g_mem_chunk_free (GMemChunk *mem_chunk,
gpointer mem);
void g_mem_chunk_clean (GMemChunk *mem_chunk);
void g_mem_chunk_reset (GMemChunk *mem_chunk);
void g_mem_chunk_print (GMemChunk *mem_chunk);
void g_mem_chunk_info (void);
/* Ah yes...we have a "g_blow_chunks" function.
* "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;
guint v_uint;
gint v_int;
gchar *v_string;
const gchar *v_string;
/* 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>
* 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;
}
gchar*
G_CONST_RETURN gchar*
g_module_error (void)
{
return g_static_private_get (&module_error_private);
@ -488,7 +488,7 @@ g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol)
{
gchar *module_error;
const gchar *module_error;
if (symbol)
*symbol = NULL;
@ -527,7 +527,7 @@ g_module_symbol (GModule *module,
return !module_error;
}
gchar*
G_CONST_RETURN gchar*
g_module_name (GModule *module)
{
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;
/* open a module `file_name' and return handle, which is NULL on error */
GModule* g_module_open (const gchar *file_name,
GModuleFlags flags);
GModule* g_module_open (const gchar *file_name,
GModuleFlags flags);
/* 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 */
void g_module_make_resident (GModule *module);
void g_module_make_resident (GModule *module);
/* 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 */
gboolean g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol);
gboolean g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol);
/* 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
* 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.
*/
gchar* g_module_build_path (const gchar *directory,
const gchar *module_name);
gchar* g_module_build_path (const gchar *directory,
const gchar *module_name);
#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>
* genums.h (G_TYPE_IS_FLAGS): patch from sven to fixup

View File

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

View File

@ -813,7 +813,7 @@ g_signal_lookup (const gchar *name,
return signal_id;
}
gchar*
G_CONST_RETURN gchar*
g_signal_name (guint signal_id)
{
SignalNode *node;
@ -873,7 +873,7 @@ g_signal_list_ids (GType itype,
for (i = 0; i < n_nodes; i++)
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
* name with "-" instead of "_".

View File

@ -88,55 +88,56 @@ struct _GSignalQuery
/* --- signals --- */
guint g_signal_newv (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
GType *param_types);
guint g_signal_new_valist (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
va_list args);
guint g_signal_newc (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
guint class_offset,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
...);
void g_signal_emitv (const GValue *instance_and_params,
guint signal_id,
GQuark detail,
GValue *return_value);
void g_signal_emit_valist (gpointer instance,
guint signal_id,
GQuark detail,
va_list var_args);
void g_signal_emit (gpointer instance,
guint signal_id,
GQuark detail,
...);
void g_signal_emit_by_name (gpointer instance,
const gchar *detailed_signal,
...);
guint g_signal_lookup (const gchar *name,
GType itype);
gchar* g_signal_name (guint signal_id);
void g_signal_query (guint signal_id,
GSignalQuery *query);
guint* g_signal_list_ids (GType itype,
guint *n_ids);
guint g_signal_newv (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
GType *param_types);
guint g_signal_new_valist (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GClosure *class_closure,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
va_list args);
guint g_signal_newc (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
guint class_offset,
GSignalAccumulator accumulator,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
...);
void g_signal_emitv (const GValue *instance_and_params,
guint signal_id,
GQuark detail,
GValue *return_value);
void g_signal_emit_valist (gpointer instance,
guint signal_id,
GQuark detail,
va_list var_args);
void g_signal_emit (gpointer instance,
guint signal_id,
GQuark detail,
...);
void g_signal_emit_by_name (gpointer instance,
const gchar *detailed_signal,
...);
guint g_signal_lookup (const gchar *name,
GType itype);
G_CONST_RETURN gchar* g_signal_name (guint signal_id);
void g_signal_query (guint signal_id,
GSignalQuery *query);
guint* g_signal_list_ids (GType itype,
guint *n_ids);
/* --- signal emissions --- */
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 INVALID_RECURSION(func, arg, type_name) G_STMT_START{ \
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) \
g_error ("%s(%p)%s`%s'", _fname, _arg, _action, _tname); \
else \
@ -145,7 +145,7 @@ struct _TypeNode
#define MAX_N_IFACES (511)
#define NODE_TYPE(node) (node->supers[0])
#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
{
@ -431,13 +431,13 @@ type_descriptive_name_L (GType type)
static inline gchar*
type_descriptive_name_U (GType type)
{
gchar *name;
const gchar *name;
G_READ_LOCK (&type_rw_lock);
name = type_descriptive_name_L (type);
G_READ_UNLOCK (&type_rw_lock);
return name;
return (gchar *)name;
}
@ -1816,7 +1816,7 @@ g_type_value_table_peek (GType type)
return vtable;
}
gchar*
G_CONST_RETURN gchar*
g_type_name (GType type)
{
TypeNode *node;
@ -2409,7 +2409,7 @@ g_type_init (GTypeDebugFlags debug_flags)
{
G_LOCK_DEFINE_STATIC (type_init_lock);
static TypeNode *type0_node = NULL;
gchar *env_string;
const gchar *env_string;
GTypeInfo info;
TypeNode *node;
GType type;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -226,7 +226,7 @@ g_strtod (const gchar *nptr,
}
}
gchar*
G_CONST_RETURN gchar*
g_strerror (gint errnum)
{
static GStaticPrivate msg_private = G_STATIC_PRIVATE_INIT;
@ -669,7 +669,7 @@ g_strerror (gint errnum)
return msg;
}
gchar*
G_CONST_RETURN gchar*
g_strsignal (gint signum)
{
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.
*/
#define G_STR_DELIMITERS "_-|> <."
gchar* g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strcanon (gchar *string,
const gchar *valid_chars,
gchar subsitutor);
gdouble g_strtod (const gchar *nptr,
gchar **endptr);
gchar* g_strerror (gint errnum) G_GNUC_CONST;
gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
gint g_strncasecmp (const gchar *s1,
const gchar *s2,
guint n);
gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest,
const gchar *src,
gsize dest_size);
gsize g_strlcat (gchar *dest,
const gchar *src,
gsize dest_size);
gchar* g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strcanon (gchar *string,
const gchar *valid_chars,
gchar subsitutor);
gdouble g_strtod (const gchar *nptr,
gchar **endptr);
G_CONST_RETURN gchar* g_strerror (gint errnum) G_GNUC_CONST;
G_CONST_RETURN gchar* g_strsignal (gint signum) G_GNUC_CONST;
gint g_strcasecmp (const gchar *s1,
const gchar *s2);
gint g_strncasecmp (const gchar *s1,
const gchar *s2,
guint n);
gchar* g_strdown (gchar *string);
gchar* g_strup (gchar *string);
gchar* g_strreverse (gchar *string);
gsize g_strlcpy (gchar *dest,
const gchar *src,
gsize dest_size);
gsize g_strlcat (gchar *dest,
const gchar *src,
gsize dest_size);
/* removes leading spaces */
gchar* g_strchug (gchar *string);
gchar* g_strchug (gchar *string);
/* removes trailing spaces */
gchar* g_strchomp (gchar *string);
gchar* g_strchomp (gchar *string);
/* removes leading & trailing spaces */
#define g_strstrip( string ) g_strchomp (g_strchug (string))
/* String utility functions that return a newly allocated string which
* ought to be freed with g_free from the caller at some point.
*/
gchar* g_strdup (const gchar *str);
gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format,
va_list args);
gchar* g_strndup (const gchar *str,
guint n);
gchar* g_strnfill (guint length,
gchar fill_char);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
gchar* g_strdup (const gchar *str);
gchar* g_strdup_printf (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
gchar* g_strdup_vprintf (const gchar *format,
va_list args);
gchar* g_strndup (const gchar *str,
guint n);
gchar* g_strnfill (guint length,
gchar fill_char);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gchar* g_strjoin (const gchar *separator,
...); /* NULL terminated */
/* Make a copy of a string interpreting C string -style escape
* sequences. Inverse of g_strescape. The recognized sequences are \b
* \f \n \r \t \\ \" and the octal format.
*/
gchar* g_strcompress (const gchar *source);
gchar* g_strcompress (const gchar *source);
/* Copy a string escaping nonprintable characters like in C strings.
* 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
* provides mostly identical semantics.
*/
gchar* g_strescape (const gchar *source,
const gchar *exceptions);
gchar* g_strescape (const gchar *source,
const gchar *exceptions);
gpointer g_memdup (gconstpointer mem,
guint byte_size);
gpointer g_memdup (gconstpointer mem,
guint byte_size);
/* NULL terminated string arrays.
* 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_strdupv() copies a NULL-terminated array of strings
*/
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gint max_tokens);
gchar* g_strjoinv (const gchar *separator,
gchar **str_array);
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gint max_tokens);
gchar* g_strjoinv (const gchar *separator,
gchar **str_array);
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
G_END_DECLS

View File

@ -46,6 +46,8 @@
#include <unistd.h>
#endif
#include <string.h>
#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
# define g_system_thread_equal(thread1, thread2) \
(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)])
gunichar g_utf8_get_char (const gchar *p);
gchar * g_utf8_offset_to_pointer (const gchar *str,
gint offset);
gchar* g_utf8_offset_to_pointer (const gchar *str,
gint offset);
gint g_utf8_pointer_to_offset (const gchar *str,
const gchar *pos);
gchar * g_utf8_prev_char (const gchar *p);
gchar * g_utf8_find_next_char (const gchar *p,
gchar* g_utf8_prev_char (const gchar *p);
gchar* g_utf8_find_next_char (const gchar *p,
const gchar *end);
gchar * g_utf8_find_prev_char (const gchar *str,
gchar* g_utf8_find_prev_char (const gchar *str,
const gchar *p);
gint g_utf8_strlen (const gchar *p,
gint max);
/* Copies n characters from src to dest */
gchar *g_utf8_strncpy (gchar *dest,
gchar* g_utf8_strncpy (gchar *dest,
const gchar *src,
size_t n);
/* Find the UTF-8 character corresponding to ch, in string p. These
functions are equivalants to strchr and strrchr */
gchar *g_utf8_strchr (const gchar *p,
gchar* g_utf8_strchr (const gchar *p,
gunichar c);
gchar *g_utf8_strrchr (const gchar *p,
gchar* g_utf8_strrchr (const gchar *p,
gunichar c);
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_written,
GError **error);
gchar * g_utf16_to_utf8 (const gunichar2 *str,
gchar* g_utf16_to_utf8 (const gunichar2 *str,
gint len,
gint *items_read,
gint *items_written,
@ -234,7 +234,7 @@ gunichar2 *g_ucs4_to_utf16 (const gunichar *str,
gint *items_read,
gint *items_written,
GError **error);
gchar * g_ucs4_to_utf8 (const gunichar *str,
gchar* g_ucs4_to_utf8 (const gunichar *str,
gint len,
gint *items_read,
gint *items_written,

View File

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

View File

@ -113,12 +113,12 @@ G_BEGIN_DECLS
/* Retrive static string info
*/
gchar* g_get_user_name (void);
gchar* g_get_real_name (void);
gchar* g_get_home_dir (void);
gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname);
G_CONST_RETURN gchar* g_get_user_name (void);
G_CONST_RETURN gchar* g_get_real_name (void);
G_CONST_RETURN gchar* g_get_home_dir (void);
G_CONST_RETURN gchar* g_get_tmp_dir (void);
gchar* g_get_prgname (void);
void g_set_prgname (const gchar *prgname);
typedef struct _GDebugKey GDebugKey;
@ -130,40 +130,42 @@ struct _GDebugKey
/* Miscellaneous utility functions
*/
guint g_parse_debug_string (const gchar *string,
GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string,
gulong n,
gchar const *format,
va_list args);
guint g_parse_debug_string (const gchar *string,
GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
gchar const *format,
...) G_GNUC_PRINTF (3, 4);
gint g_vsnprintf (gchar *string,
gulong n,
gchar const *format,
va_list args);
/* 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 */
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
* major release of GLib. Use g_path_get_dirname/g_path_get_basename
* instead. Whatch out! The string returned by g_path_get_basename
* must be g_freed, while the string returned by g_basename must not.*/
gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name);
G_CONST_RETURN gchar* g_basename (const gchar *file_name);
gchar* g_dirname (const gchar *file_name);
/* The returned strings are newly allocated with g_malloc() */
gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name);
gchar* g_get_current_dir (void);
gchar* g_path_get_basename (const gchar *file_name);
gchar* g_path_get_dirname (const gchar *file_name);
/* Get the codeset for the current locale */
/* gchar * g_get_codeset (void); */
/* return the environment string for the variable. The returned memory
* 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

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
* 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
* the corresponding message. The returned string should be deallocated
* 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 * g_win32_get_package_installation_subdirectory (gchar *package,
gchar* g_win32_get_package_installation_subdirectory (gchar *package,
gchar *dll_name,
gchar *subdir);

View File

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

View File

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