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,7 +622,7 @@ static GMutex *mem_chunks_lock = NULL;
static GRealMemChunk *mem_chunks = NULL;
GMemChunk*
g_mem_chunk_new (gchar *name,
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
@ -1135,7 +1135,7 @@ typedef struct {
} GMinimalMemChunk;
GMemChunk*
g_mem_chunk_new (gchar *name,
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)

View File

@ -132,7 +132,7 @@ void g_mem_profile (void);
#define G_ALLOC_ONLY 1
#define G_ALLOC_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name,
GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type);

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

@ -38,7 +38,7 @@ typedef guint32 GQuark;
GQuark g_quark_try_string (const gchar *string);
GQuark g_quark_from_static_string (const gchar *string);
GQuark g_quark_from_string (const gchar *string);
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

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

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

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

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

6
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,7 +622,7 @@ static GMutex *mem_chunks_lock = NULL;
static GRealMemChunk *mem_chunks = NULL;
GMemChunk*
g_mem_chunk_new (gchar *name,
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)
@ -1135,7 +1135,7 @@ typedef struct {
} GMinimalMemChunk;
GMemChunk*
g_mem_chunk_new (gchar *name,
g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type)

2
gmem.h
View File

@ -132,7 +132,7 @@ void g_mem_profile (void);
#define G_ALLOC_ONLY 1
#define G_ALLOC_AND_FREE 2
GMemChunk* g_mem_chunk_new (gchar *name,
GMemChunk* g_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
gint type);

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

@ -68,7 +68,7 @@ gboolean g_module_close (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,
@ -76,8 +76,7 @@ gboolean g_module_symbol (GModule *module,
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
@ -93,6 +92,7 @@ gchar* g_module_name (GModule *module);
gchar* g_module_build_path (const gchar *directory,
const gchar *module_name);
#ifdef __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>
* 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

@ -132,12 +132,13 @@ void g_signal_emit_by_name (gpointer instance,
...);
guint g_signal_lookup (const gchar *name,
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,
GSignalQuery *query);
guint* g_signal_list_ids (GType itype,
guint *n_ids);
/* --- signal emissions --- */
void g_signal_stop_emission (gpointer instance,
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 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

@ -180,7 +180,7 @@ typedef enum /*< skip >*/
/* --- prototypes --- */
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);
GType g_type_from_name (const gchar *name);
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_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);
/* per-type _static_ data */
void g_type_set_qdata (GType type,
GQuark quark,

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

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

View File

@ -38,7 +38,7 @@ typedef guint32 GQuark;
GQuark g_quark_try_string (const gchar *string);
GQuark g_quark_from_static_string (const gchar *string);
GQuark g_quark_from_string (const gchar *string);
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

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

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

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

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

@ -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) ||