[glib/gobject-speedups: 1/6] Simplify g_object_new_with_properties
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gobject-speedups: 1/6] Simplify g_object_new_with_properties
- Date: Wed, 29 Sep 2021 11:29:12 +0000 (UTC)
commit 421447eaf29413a4144fcfe1c476857d62660053
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 29 00:18:51 2021 -0400
Simplify g_object_new_with_properties
This was doing an unnecessary extra copy of
the GValues. We can avoid that.
gobject/gobject.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index c05de431e..8b21f6b58 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2121,19 +2121,10 @@ g_object_new_with_properties (GType object_type,
if (!g_object_new_is_valid_property (object_type, pspec, names[i], params, count))
continue;
params[count].pspec = pspec;
-
- /* Init GValue */
- params[count].value = g_newa (GValue, 1);
- memset (params[count].value, 0, sizeof (GValue));
- g_value_init (params[count].value, G_VALUE_TYPE (&values[i]));
-
- g_value_copy (&values[i], params[count].value);
+ params[count].value = (GValue *)&values[i];
count++;
}
object = g_object_new_internal (class, params, count);
-
- while (count--)
- g_value_unset (params[count].value);
}
else
object = g_object_new_internal (class, NULL, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]