Use inline functions for dictionary helpers
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 19 Dec 2009 20:12:49 +0000 (12:12 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 19 Dec 2009 20:12:49 +0000 (12:12 -0800)
include/dbus.h
src/dbus.c

index 2b75d364120459334a7cd207d653d0d76ec57d15..3757fef8148d9c427bc33bb04ccd1abeb083b6e5 100644 (file)
@@ -70,13 +70,39 @@ static inline void connman_dbus_dict_close(DBusMessageIter *iter,
        dbus_message_iter_close_container(iter, dict);
 }
 
-void connman_dbus_dict_append_variant(DBusMessageIter *dict,
-                                       const char *key, int type, void *val);
+static inline void connman_dbus_dict_append_variant(DBusMessageIter *dict,
+                                       const char *key, int type, void *val)
+{
+       DBusMessageIter entry;
 
-void connman_dbus_dict_append_fixed_array(DBusMessageIter *dict,
-                               const char *key, int type, void *val, int len);
-void connman_dbus_dict_append_variable_array(DBusMessageIter *dict,
-               const char *key, int type, connman_dbus_append_cb_t function);
+       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+                                                               NULL, &entry);
+       connman_dbus_property_append_variant(&entry, key, type, val);
+       dbus_message_iter_close_container(dict, &entry);
+}
+
+static inline void connman_dbus_dict_append_fixed_array(DBusMessageIter *dict,
+                               const char *key, int type, void *val, int len)
+{
+       DBusMessageIter entry;
+
+       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+                                                               NULL, &entry);
+       connman_dbus_property_append_fixed_array(&entry, key, type, val, len);
+       dbus_message_iter_close_container(dict, &entry);
+}
+
+static inline void connman_dbus_dict_append_variable_array(DBusMessageIter *dict,
+               const char *key, int type, connman_dbus_append_cb_t function)
+{
+       DBusMessageIter entry;
+
+       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
+                                                               NULL, &entry);
+       connman_dbus_property_append_variable_array(&entry, key,
+                                                       type, function);
+       dbus_message_iter_close_container(dict, &entry);
+}
 
 dbus_bool_t connman_dbus_validate_ident(const char *ident);
 char *connman_dbus_encode_string(const char *value);
index e1189fee92b945d024ef09595f360fc0d2b11e78..7308a49a22bc455d334e5c65f21c018ae1c961c8 100644 (file)
@@ -179,46 +179,6 @@ void connman_dbus_property_append_variable_array(DBusMessageIter *iter,
        dbus_message_iter_close_container(iter, &value);
 }
 
-void connman_dbus_dict_append_variant(DBusMessageIter *dict,
-                                       const char *key, int type, void *val)
-{
-       DBusMessageIter entry;
-
-       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
-                                                               NULL, &entry);
-
-       connman_dbus_property_append_variant(&entry, key, type, val);
-
-       dbus_message_iter_close_container(dict, &entry);
-}
-
-void connman_dbus_dict_append_fixed_array(DBusMessageIter *dict,
-                               const char *key, int type, void *val, int len)
-{
-       DBusMessageIter entry;
-
-       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
-                                                               NULL, &entry);
-
-       connman_dbus_property_append_fixed_array(&entry, key, type, val, len);
-
-       dbus_message_iter_close_container(dict, &entry);
-}
-
-void connman_dbus_dict_append_variable_array(DBusMessageIter *dict,
-               const char *key, int type, connman_dbus_append_cb_t function)
-{
-       DBusMessageIter entry;
-
-       dbus_message_iter_open_container(dict, DBUS_TYPE_DICT_ENTRY,
-                                                               NULL, &entry);
-
-       connman_dbus_property_append_variable_array(&entry, key,
-                                                       type, function);
-       
-       dbus_message_iter_close_container(dict, &entry);
-}
-
 static DBusConnection *connection = NULL;
 
 DBusConnection *connman_dbus_get_connection(void)