[glib] g_object_new(): skip varargs for simple calls
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] g_object_new(): skip varargs for simple calls
- Date: Mon, 11 Jan 2010 14:52:05 +0000 (UTC)
commit f4ccd96ea1a137eb0c533f177ff87290a84ee0d5
Author: Kamal Mostafa <kamal whence com>
Date: Fri Jan 1 20:36:28 2010 -0800
g_object_new(): skip varargs for simple calls
g_object_new() avoids useless varargs processing for simple calls with no
properties. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=605883
gobject/gobject.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 58554c3..bd63152 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1087,6 +1087,10 @@ g_object_new (GType object_type,
g_return_val_if_fail (G_TYPE_IS_OBJECT (object_type), NULL);
+ /* short circuit for calls supplying no properties */
+ if (!first_property_name)
+ return g_object_newv (object_type, 0, NULL);
+
va_start (var_args, first_property_name);
object = g_object_new_valist (object_type, first_property_name, var_args);
va_end (var_args);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]