summaryrefslogtreecommitdiff
path: root/gobject
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-02-17 23:30:48 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-02-17 23:30:48 +0000
commit1c391cc69846713b0406545146ea232efc5f34e2 (patch)
tree2941b3344e0111ac049df088fae03216ce473245 /gobject
parentadfafc0872a0d787eb46b8a487fcd8db91ec34fb (diff)
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
Diffstat (limited to 'gobject')
-rw-r--r--gobject/ChangeLog12
-rw-r--r--gobject/gobject-query.c2
-rw-r--r--gobject/gsignal.c4
-rw-r--r--gobject/gsignal.h99
-rw-r--r--gobject/gtype.c12
-rw-r--r--gobject/gtype.h54
-rw-r--r--gobject/gvaluetypes.c2
-rw-r--r--gobject/gvaluetypes.h87
8 files changed, 142 insertions, 130 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 6d8f04fbe..a97faf0e1 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -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
diff --git a/gobject/gobject-query.c b/gobject/gobject-query.c
index 8a440db3a..37f87980c 100644
--- a/gobject/gobject-query.c
+++ b/gobject/gobject-query.c
@@ -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);
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 3c91c679d..14a9cea36 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -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 "_".
diff --git a/gobject/gsignal.h b/gobject/gsignal.h
index b81a92aab..312c5e055 100644
--- a/gobject/gsignal.h
+++ b/gobject/gsignal.h
@@ -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,
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 4e4096f36..bcbed34f8 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -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;
diff --git a/gobject/gtype.h b/gobject/gtype.h
index b0a0c503d..d3604e398 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -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);
diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c
index 42193b2f6..1e8ae92cd 100644
--- a/gobject/gvaluetypes.c
+++ b/gobject/gvaluetypes.c
@@ -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);
diff --git a/gobject/gvaluetypes.h b/gobject/gvaluetypes.h
index a7405cc78..5cf5b8865 100644
--- a/gobject/gvaluetypes.h
+++ b/gobject/gvaluetypes.h
@@ -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
}