Merge branch 'backport-2254-object-set-performance-glib-2-70' into 'glib-2-70'

Backport !2254 “Small optimization for g_object_set” to glib-2-70

See merge request GNOME/glib!2256
This commit is contained in:
Emmanuele Bassi 2021-09-20 13:46:04 +00:00
commit 6918c035ce

View File

@ -1570,15 +1570,9 @@ object_set_property (GObject *object,
{
class->set_property (object, param_id, &tmp_value, pspec);
if (~pspec->flags & G_PARAM_EXPLICIT_NOTIFY)
{
GParamSpec *notify_pspec;
notify_pspec = get_notify_pspec (pspec);
if (notify_pspec != NULL)
g_object_notify_queue_add (object, nqueue, notify_pspec);
}
if (~pspec->flags & G_PARAM_EXPLICIT_NOTIFY &&
pspec->flags & G_PARAM_READABLE)
g_object_notify_queue_add (object, nqueue, pspec);
}
g_value_unset (&tmp_value);
}
@ -2529,17 +2523,14 @@ g_object_getv (GObject *object,
g_object_ref (object);
memset (values, 0, n_properties * sizeof (GValue));
obj_type = G_OBJECT_TYPE (object);
for (i = 0; i < n_properties; i++)
{
pspec = g_param_spec_pool_lookup (pspec_pool,
names[i],
obj_type,
TRUE);
pspec = g_param_spec_pool_lookup (pspec_pool, names[i], obj_type, TRUE);
if (!g_object_get_is_valid_property (object, pspec, names[i]))
break;
memset (&values[i], 0, sizeof (GValue));
g_value_init (&values[i], pspec->value_type);
object_get_property (object, pspec, &values[i]);
}