mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gobject: Use G_VALUE_INIT
This commit is contained in:
parent
8d3250016d
commit
108480b7ba
@ -350,8 +350,8 @@ on_source_notify (GObject *gobject,
|
|||||||
GBinding *binding)
|
GBinding *binding)
|
||||||
{
|
{
|
||||||
const gchar *p_name;
|
const gchar *p_name;
|
||||||
GValue source_value = { 0, };
|
GValue source_value = G_VALUE_INIT;
|
||||||
GValue target_value = { 0, };
|
GValue target_value = G_VALUE_INIT;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
if (binding->is_frozen)
|
if (binding->is_frozen)
|
||||||
@ -391,8 +391,8 @@ on_target_notify (GObject *gobject,
|
|||||||
GBinding *binding)
|
GBinding *binding)
|
||||||
{
|
{
|
||||||
const gchar *p_name;
|
const gchar *p_name;
|
||||||
GValue source_value = { 0, };
|
GValue source_value = G_VALUE_INIT;
|
||||||
GValue target_value = { 0, };
|
GValue target_value = G_VALUE_INIT;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
if (binding->is_frozen)
|
if (binding->is_frozen)
|
||||||
@ -1026,8 +1026,8 @@ bind_with_closures_transform_to (GBinding *binding,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
TransformData *t_data = data;
|
TransformData *t_data = data;
|
||||||
GValue params[3] = { { 0, }, { 0, }, { 0, } };
|
GValue params[3] = { G_VALUE_INIT, G_VALUE_INIT, G_VALUE_INIT };
|
||||||
GValue retval = { 0, };
|
GValue retval = G_VALUE_INIT;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
g_value_init (¶ms[0], G_TYPE_BINDING);
|
g_value_init (¶ms[0], G_TYPE_BINDING);
|
||||||
@ -1069,8 +1069,8 @@ bind_with_closures_transform_from (GBinding *binding,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
TransformData *t_data = data;
|
TransformData *t_data = data;
|
||||||
GValue params[3] = { { 0, }, { 0, }, { 0, } };
|
GValue params[3] = { G_VALUE_INIT, G_VALUE_INIT, G_VALUE_INIT };
|
||||||
GValue retval = { 0, };
|
GValue retval = G_VALUE_INIT;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
g_value_init (¶ms[0], G_TYPE_BINDING);
|
g_value_init (¶ms[0], G_TYPE_BINDING);
|
||||||
|
@ -1144,7 +1144,7 @@ object_set_property (GObject *object,
|
|||||||
const GValue *value,
|
const GValue *value,
|
||||||
GObjectNotifyQueue *nqueue)
|
GObjectNotifyQueue *nqueue)
|
||||||
{
|
{
|
||||||
GValue tmp_value = { 0, };
|
GValue tmp_value = G_VALUE_INIT;
|
||||||
GObjectClass *class = g_type_class_peek (pspec->owner_type);
|
GObjectClass *class = g_type_class_peek (pspec->owner_type);
|
||||||
guint param_id = PARAM_SPEC_PARAM_ID (pspec);
|
guint param_id = PARAM_SPEC_PARAM_ID (pspec);
|
||||||
GParamSpec *redirect;
|
GParamSpec *redirect;
|
||||||
@ -1683,7 +1683,7 @@ g_object_set_valist (GObject *object,
|
|||||||
name = first_property_name;
|
name = first_property_name;
|
||||||
while (name)
|
while (name)
|
||||||
{
|
{
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
|
|
||||||
@ -1764,7 +1764,7 @@ g_object_get_valist (GObject *object,
|
|||||||
|
|
||||||
while (name)
|
while (name)
|
||||||
{
|
{
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
gchar *error;
|
gchar *error;
|
||||||
|
|
||||||
@ -1977,7 +1977,7 @@ g_object_get_property (GObject *object,
|
|||||||
G_OBJECT_TYPE_NAME (object));
|
G_OBJECT_TYPE_NAME (object));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GValue *prop_value, tmp_value = { 0, };
|
GValue *prop_value, tmp_value = G_VALUE_INIT;
|
||||||
|
|
||||||
/* auto-conversion of the callers value type
|
/* auto-conversion of the callers value type
|
||||||
*/
|
*/
|
||||||
|
@ -605,7 +605,7 @@ gboolean
|
|||||||
g_param_value_defaults (GParamSpec *pspec,
|
g_param_value_defaults (GParamSpec *pspec,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GValue dflt_value = { 0, };
|
GValue dflt_value = G_VALUE_INIT;
|
||||||
gboolean defaults;
|
gboolean defaults;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
||||||
@ -679,7 +679,7 @@ g_param_value_convert (GParamSpec *pspec,
|
|||||||
GValue *dest_value,
|
GValue *dest_value,
|
||||||
gboolean strict_validation)
|
gboolean strict_validation)
|
||||||
{
|
{
|
||||||
GValue tmp_value = { 0, };
|
GValue tmp_value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
|
||||||
g_return_val_if_fail (G_IS_VALUE (src_value), FALSE);
|
g_return_val_if_fail (G_IS_VALUE (src_value), FALSE);
|
||||||
|
@ -2049,7 +2049,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GValue return_value = { 0, };
|
GValue return_value = G_VALUE_INIT;
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
GType rtype = signal_return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
|
GType rtype = signal_return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
|
||||||
gboolean static_scope = signal_return_type & G_SIGNAL_TYPE_STATIC_SCOPE;
|
gboolean static_scope = signal_return_type & G_SIGNAL_TYPE_STATIC_SCOPE;
|
||||||
@ -3003,7 +3003,7 @@ g_signal_emit_valist (gpointer instance,
|
|||||||
signal_emit_unlocked_R (node, detail, instance, NULL, instance_and_params);
|
signal_emit_unlocked_R (node, detail, instance, NULL, instance_and_params);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GValue return_value = { 0, };
|
GValue return_value = G_VALUE_INIT;
|
||||||
gchar *error = NULL;
|
gchar *error = NULL;
|
||||||
GType rtype = signal_return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
|
GType rtype = signal_return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
|
||||||
gboolean static_scope = signal_return_type & G_SIGNAL_TYPE_STATIC_SCOPE;
|
gboolean static_scope = signal_return_type & G_SIGNAL_TYPE_STATIC_SCOPE;
|
||||||
@ -3130,7 +3130,7 @@ signal_emit_unlocked_R (SignalNode *node,
|
|||||||
GClosure *class_closure;
|
GClosure *class_closure;
|
||||||
HandlerList *hlist;
|
HandlerList *hlist;
|
||||||
Handler *handler_list = NULL;
|
Handler *handler_list = NULL;
|
||||||
GValue *return_accu, accu = { 0, };
|
GValue *return_accu, accu = G_VALUE_INIT;
|
||||||
guint signal_id;
|
guint signal_id;
|
||||||
gulong max_sequential_handler_number;
|
gulong max_sequential_handler_number;
|
||||||
gboolean return_value_altered = FALSE;
|
gboolean return_value_altered = FALSE;
|
||||||
|
@ -80,8 +80,8 @@ io_watch_closure_callback (GIOChannel *channel,
|
|||||||
{
|
{
|
||||||
GClosure *closure = data;
|
GClosure *closure = data;
|
||||||
|
|
||||||
GValue params[2] = { { 0, }, { 0, } };
|
GValue params[2] = { G_VALUE_INIT, G_VALUE_INIT };
|
||||||
GValue result_value = { 0, };
|
GValue result_value = G_VALUE_INIT;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
g_value_init (&result_value, G_TYPE_BOOLEAN);
|
g_value_init (&result_value, G_TYPE_BOOLEAN);
|
||||||
@ -105,7 +105,7 @@ static gboolean
|
|||||||
source_closure_callback (gpointer data)
|
source_closure_callback (gpointer data)
|
||||||
{
|
{
|
||||||
GClosure *closure = data;
|
GClosure *closure = data;
|
||||||
GValue result_value = { 0, };
|
GValue result_value = G_VALUE_INIT;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
g_value_init (&result_value, G_TYPE_BOOLEAN);
|
g_value_init (&result_value, G_TYPE_BOOLEAN);
|
||||||
|
@ -1355,7 +1355,7 @@ g_strdup_value_contents (const GValue *value)
|
|||||||
}
|
}
|
||||||
else if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
|
else if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
|
||||||
{
|
{
|
||||||
GValue tmp_value = { 0, };
|
GValue tmp_value = G_VALUE_INIT;
|
||||||
gchar *s;
|
gchar *s;
|
||||||
|
|
||||||
g_value_init (&tmp_value, G_TYPE_STRING);
|
g_value_init (&tmp_value, G_TYPE_STRING);
|
||||||
|
@ -61,7 +61,7 @@ test_define_boxed (void)
|
|||||||
static void
|
static void
|
||||||
test_boxed_ownership (void)
|
test_boxed_ownership (void)
|
||||||
{
|
{
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
static MyBoxed boxed = { 10, "bla" };
|
static MyBoxed boxed = { 10, "bla" };
|
||||||
|
|
||||||
g_value_init (&value, MY_TYPE_BOXED);
|
g_value_init (&value, MY_TYPE_BOXED);
|
||||||
@ -104,7 +104,7 @@ test_boxed_closure (void)
|
|||||||
{
|
{
|
||||||
GClosure *closure;
|
GClosure *closure;
|
||||||
GClosure *closure2;
|
GClosure *closure2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_CLOSURE);
|
g_value_init (&value, G_TYPE_CLOSURE);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -128,7 +128,7 @@ test_boxed_date (void)
|
|||||||
{
|
{
|
||||||
GDate *date;
|
GDate *date;
|
||||||
GDate *date2;
|
GDate *date2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_DATE);
|
g_value_init (&value, G_TYPE_DATE);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -150,9 +150,9 @@ test_boxed_date (void)
|
|||||||
static void
|
static void
|
||||||
test_boxed_value (void)
|
test_boxed_value (void)
|
||||||
{
|
{
|
||||||
GValue value1 = { 0, };
|
GValue value1 = G_VALUE_INIT;
|
||||||
GValue *value2;
|
GValue *value2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_VALUE);
|
g_value_init (&value, G_TYPE_VALUE);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -179,7 +179,7 @@ test_boxed_string (void)
|
|||||||
{
|
{
|
||||||
GString *v;
|
GString *v;
|
||||||
GString *v2;
|
GString *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_GSTRING);
|
g_value_init (&value, G_TYPE_GSTRING);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -203,7 +203,7 @@ test_boxed_hashtable (void)
|
|||||||
{
|
{
|
||||||
GHashTable *v;
|
GHashTable *v;
|
||||||
GHashTable *v2;
|
GHashTable *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_HASH_TABLE);
|
g_value_init (&value, G_TYPE_HASH_TABLE);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -226,7 +226,7 @@ test_boxed_array (void)
|
|||||||
{
|
{
|
||||||
GArray *v;
|
GArray *v;
|
||||||
GArray *v2;
|
GArray *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_ARRAY);
|
g_value_init (&value, G_TYPE_ARRAY);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -249,7 +249,7 @@ test_boxed_ptrarray (void)
|
|||||||
{
|
{
|
||||||
GPtrArray *v;
|
GPtrArray *v;
|
||||||
GPtrArray *v2;
|
GPtrArray *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_PTR_ARRAY);
|
g_value_init (&value, G_TYPE_PTR_ARRAY);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -272,7 +272,7 @@ test_boxed_regex (void)
|
|||||||
{
|
{
|
||||||
GRegex *v;
|
GRegex *v;
|
||||||
GRegex *v2;
|
GRegex *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_REGEX);
|
g_value_init (&value, G_TYPE_REGEX);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -295,7 +295,7 @@ test_boxed_varianttype (void)
|
|||||||
{
|
{
|
||||||
GVariantType *v;
|
GVariantType *v;
|
||||||
GVariantType *v2;
|
GVariantType *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_VARIANT_TYPE);
|
g_value_init (&value, G_TYPE_VARIANT_TYPE);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -319,7 +319,7 @@ test_boxed_datetime (void)
|
|||||||
{
|
{
|
||||||
GDateTime *v;
|
GDateTime *v;
|
||||||
GDateTime *v2;
|
GDateTime *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_DATE_TIME);
|
g_value_init (&value, G_TYPE_DATE_TIME);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
@ -342,7 +342,7 @@ test_boxed_error (void)
|
|||||||
{
|
{
|
||||||
GError *v;
|
GError *v;
|
||||||
GError *v2;
|
GError *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_ERROR);
|
g_value_init (&value, G_TYPE_ERROR);
|
||||||
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
g_assert (G_VALUE_HOLDS_BOXED (&value));
|
||||||
|
@ -14,7 +14,7 @@ test_enum_basic (void)
|
|||||||
GType type;
|
GType type;
|
||||||
GEnumClass *class;
|
GEnumClass *class;
|
||||||
GEnumValue *val;
|
GEnumValue *val;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
type = g_enum_register_static ("MyEnum", my_enum_values);
|
type = g_enum_register_static ("MyEnum", my_enum_values);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ test_flags_basic (void)
|
|||||||
GType type;
|
GType type;
|
||||||
GFlagsClass *class;
|
GFlagsClass *class;
|
||||||
GFlagsValue *val;
|
GFlagsValue *val;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
type = g_flags_register_static ("MyFlags", my_flag_values);
|
type = g_flags_register_static ("MyFlags", my_flag_values);
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ base_object_constructor (GType type,
|
|||||||
/* The constructor is the one place where a GParamSpecOverride is visible
|
/* The constructor is the one place where a GParamSpecOverride is visible
|
||||||
* to the outside world, so we do a bunch of checks here
|
* to the outside world, so we do a bunch of checks here
|
||||||
*/
|
*/
|
||||||
GValue value1 = { 0, };
|
GValue value1 = G_VALUE_INIT;
|
||||||
GValue value2 = { 0, };
|
GValue value2 = G_VALUE_INIT;
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
|
|
||||||
g_assert (n_construct_properties == 1);
|
g_assert (n_construct_properties == 1);
|
||||||
|
@ -6,7 +6,7 @@ test_param_value (void)
|
|||||||
{
|
{
|
||||||
GParamSpec *p, *p2;
|
GParamSpec *p, *p2;
|
||||||
GParamSpec *pp;
|
GParamSpec *pp;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_PARAM);
|
g_value_init (&value, G_TYPE_PARAM);
|
||||||
g_assert (G_VALUE_HOLDS_PARAM (&value));
|
g_assert (G_VALUE_HOLDS_PARAM (&value));
|
||||||
@ -66,7 +66,7 @@ static void
|
|||||||
test_param_validate (void)
|
test_param_validate (void)
|
||||||
{
|
{
|
||||||
GParamSpec *p;
|
GParamSpec *p;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
p = g_param_spec_int ("my-int", "My Int", "Blurb", 0, 20, 10, G_PARAM_READWRITE);
|
p = g_param_spec_int ("my-int", "My Int", "Blurb", 0, 20, 10, G_PARAM_READWRITE);
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ static void
|
|||||||
test_param_convert (void)
|
test_param_convert (void)
|
||||||
{
|
{
|
||||||
GParamSpec *p;
|
GParamSpec *p;
|
||||||
GValue v1 = { 0, };
|
GValue v1 = G_VALUE_INIT;
|
||||||
GValue v2 = { 0, };
|
GValue v2 = G_VALUE_INIT;
|
||||||
|
|
||||||
p = g_param_spec_int ("my-int", "My Int", "Blurb", 0, 20, 10, G_PARAM_READWRITE);
|
p = g_param_spec_int ("my-int", "My Int", "Blurb", 0, 20, 10, G_PARAM_READWRITE);
|
||||||
g_value_init (&v1, G_TYPE_UINT);
|
g_value_init (&v1, G_TYPE_UINT);
|
||||||
@ -133,8 +133,8 @@ test_param_convert (void)
|
|||||||
static void
|
static void
|
||||||
test_value_transform (void)
|
test_value_transform (void)
|
||||||
{
|
{
|
||||||
GValue src = { 0, };
|
GValue src = G_VALUE_INIT;
|
||||||
GValue dest = { 0, };
|
GValue dest = G_VALUE_INIT;
|
||||||
|
|
||||||
#define CHECK_INT_CONVERSION(type, getter, value) \
|
#define CHECK_INT_CONVERSION(type, getter, value) \
|
||||||
g_assert (g_value_type_transformable (G_TYPE_INT, type)); \
|
g_assert (g_value_type_transformable (G_TYPE_INT, type)); \
|
||||||
|
@ -157,7 +157,7 @@ test_object_value (void)
|
|||||||
{
|
{
|
||||||
GObject *v;
|
GObject *v;
|
||||||
GObject *v2;
|
GObject *v2;
|
||||||
GValue value = { 0, };
|
GValue value = G_VALUE_INIT;
|
||||||
|
|
||||||
g_value_init (&value, G_TYPE_OBJECT);
|
g_value_init (&value, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ test_basic (void)
|
|||||||
{
|
{
|
||||||
GValueArray *a;
|
GValueArray *a;
|
||||||
GValueArray *a2;
|
GValueArray *a2;
|
||||||
GValue v = { 0, };
|
GValue v = G_VALUE_INIT;
|
||||||
GValue *p;
|
GValue *p;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user