[glib] gobject: Use new G_VALUE_COLLECT_INIT variant
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] gobject: Use new G_VALUE_COLLECT_INIT variant
- Date: Wed, 13 Jan 2010 09:25:00 +0000 (UTC)
commit 40bf3aa5d2fd9d2aa6244ce8023ad1eed3bf0383
Author: Edward Hervey <bilboed bilboed com>
Date: Wed Dec 2 11:50:02 2009 +0100
gobject: Use new G_VALUE_COLLECT_INIT variant
Makes g_object_new_valist 20% to 30% faster (against 2321e5a).
Profiled against the pan newsreader which uses a variant of simple
and complex object creation.
https://bugzilla.gnome.org/show_bug.cgi?id=603590
gobject/gobject.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index bd63152..bf45d62 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1361,9 +1361,8 @@ g_object_new_valist (GType object_type,
params = g_renew (GParameter, params, n_alloced_params);
}
params[n_params].name = name;
- params[n_params].value.g_type = 0;
- g_value_init (¶ms[n_params].value, G_PARAM_SPEC_VALUE_TYPE (pspec));
- G_VALUE_COLLECT (¶ms[n_params].value, var_args, 0, &error);
+ G_VALUE_COLLECT_INIT (¶ms[n_params].value, G_PARAM_SPEC_VALUE_TYPE (pspec),
+ var_args, 0, &error);
if (error)
{
g_warning ("%s: %s", G_STRFUNC, error);
@@ -1476,9 +1475,8 @@ g_object_set_valist (GObject *object,
break;
}
- g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-
- G_VALUE_COLLECT (&value, var_args, 0, &error);
+ G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), var_args,
+ 0, &error);
if (error)
{
g_warning ("%s: %s", G_STRFUNC, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]