diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2008-09-17 15:02:28 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2008-09-17 15:46:50 +0100 |
commit | c371fee18e63bc19bb8b33f4261d54010a38355b (patch) | |
tree | 31b9dbaccb65a1606298d3af0e9384f2df9d3ec0 /telepathy-glib/dbus-properties-mixin.c | |
parent | 3b96eb1ec1f461077fed413522a8047277c98f83 (diff) | |
download | telepathy-glib-c371fee18e63bc19bb8b33f4261d54010a38355b.tar.gz |
_make_properties_hash: Don't point property at garbage at the end of the loop
Also, add an assertion which should help catch off-by-one errors by the
caller.
Diffstat (limited to 'telepathy-glib/dbus-properties-mixin.c')
-rw-r--r-- | telepathy-glib/dbus-properties-mixin.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/telepathy-glib/dbus-properties-mixin.c b/telepathy-glib/dbus-properties-mixin.c index 07c6e7960..75eb45256 100644 --- a/telepathy-glib/dbus-properties-mixin.c +++ b/telepathy-glib/dbus-properties-mixin.c @@ -781,18 +781,34 @@ tp_dbus_properties_mixin_make_properties_hash ( va_list ap; GHashTable *table; const gchar *interface, *property; + gboolean first = TRUE; table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); va_start (ap, first_property); - for (interface = first_interface, property = first_property; + for (interface = first_interface; interface != NULL; - interface = va_arg (ap, gchar *), property = va_arg (ap, gchar *)) + interface = va_arg (ap, gchar *)) { GValue *value = g_slice_new0 (GValue); + if (first) + { + property = first_property; + first = FALSE; + } + else + { + property = va_arg (ap, gchar *); + } + + /* If property is NULL, the caller might have omitted a comma or + * something; in any case, it shouldn't be. + */ + g_assert (property != NULL); + tp_dbus_properties_mixin_get (object, interface, property, value, NULL); /* Fetching our immutable properties had better not fail... */ |