mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-16 17:43:48 +02:00
Small optimization for g_object_setv
No need to call memset in the loop, we can just initialize all the values in one go. GtkBuilder is now using g_object_setv, so this may improve application start times a bit.
This commit is contained in:
parent
ff095d252d
commit
1197b1362c
@ -2523,17 +2523,14 @@ g_object_getv (GObject *object,
|
|||||||
|
|
||||||
g_object_ref (object);
|
g_object_ref (object);
|
||||||
|
|
||||||
|
memset (values, 0, n_properties * sizeof (GValue));
|
||||||
|
|
||||||
obj_type = G_OBJECT_TYPE (object);
|
obj_type = G_OBJECT_TYPE (object);
|
||||||
for (i = 0; i < n_properties; i++)
|
for (i = 0; i < n_properties; i++)
|
||||||
{
|
{
|
||||||
pspec = g_param_spec_pool_lookup (pspec_pool,
|
pspec = g_param_spec_pool_lookup (pspec_pool, names[i], obj_type, TRUE);
|
||||||
names[i],
|
|
||||||
obj_type,
|
|
||||||
TRUE);
|
|
||||||
if (!g_object_get_is_valid_property (object, pspec, names[i]))
|
if (!g_object_get_is_valid_property (object, pspec, names[i]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
memset (&values[i], 0, sizeof (GValue));
|
|
||||||
g_value_init (&values[i], pspec->value_type);
|
g_value_init (&values[i], pspec->value_type);
|
||||||
object_get_property (object, pspec, &values[i]);
|
object_get_property (object, pspec, &values[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user