summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-12-02 11:49:49 +0100
committerEdward Hervey <bilboed@bilboed.com>2009-12-29 11:17:10 +0100
commitded377a4f4cda1d19538f55b1693df8ebfdbf7d3 (patch)
tree88002f773c6cf297565dcd88ef4e4964deb23c07
parentcaf176ea538cdbfb0060fa920f94010e572efe3d (diff)
gsignal: Use new G_VALUE_COLLECT_INIT variant
Makes g_signal_emit_valist from 15% to 20% faster. Results reported from profiling the pan newsreader which uses a variant of simple and complex signal emissions (i.e no args or various args) https://bugzilla.gnome.org/show_bug.cgi?id=603590
-rw-r--r--gobject/gsignal.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index d69b880cf..c7c16799b 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -1971,7 +1971,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
va_start (var_args, instance);
signal_return_type = node->return_type;
- instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
+ instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)
@@ -1980,13 +1980,11 @@ g_signal_chain_from_overridden_handler (gpointer instance,
GType ptype = node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
gboolean static_scope = node->param_types[i] & G_SIGNAL_TYPE_STATIC_SCOPE;
- param_values[i].g_type = 0;
SIGNAL_UNLOCK ();
- g_value_init (param_values + i, ptype);
- G_VALUE_COLLECT (param_values + i,
- var_args,
- static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
- &error);
+ G_VALUE_COLLECT_INIT (param_values + i, ptype,
+ var_args,
+ static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
+ &error);
if (error)
{
g_warning ("%s: %s", G_STRLOC, error);
@@ -2940,7 +2938,7 @@ g_signal_emit_valist (gpointer instance,
n_params = node->n_params;
signal_return_type = node->return_type;
- instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
+ instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)
@@ -2949,13 +2947,11 @@ g_signal_emit_valist (gpointer instance,
GType ptype = node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE;
gboolean static_scope = node->param_types[i] & G_SIGNAL_TYPE_STATIC_SCOPE;
- param_values[i].g_type = 0;
SIGNAL_UNLOCK ();
- g_value_init (param_values + i, ptype);
- G_VALUE_COLLECT (param_values + i,
- var_args,
- static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
- &error);
+ G_VALUE_COLLECT_INIT (param_values + i, ptype,
+ var_args,
+ static_scope ? G_VALUE_NOCOPY_CONTENTS : 0,
+ &error);
if (error)
{
g_warning ("%s: %s", G_STRLOC, error);