diff --git a/client/main.c b/client/main.c
index be785c5..1063755 100644
--- a/client/main.c
+++ b/client/main.c
dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
}
+static void remove_device(GDBusProxy *proxy)
+{
+ char *path;
+
+ path = g_strdup(g_dbus_proxy_get_path(proxy));
+
+ if (g_dbus_proxy_method_call(default_ctrl, "RemoveDevice",
+ remove_device_setup,
+ remove_device_reply,
+ path, g_free) == FALSE) {
+ rl_printf("Failed to remove device\n");
+ g_free(path);
+ }
+}
+
static void cmd_remove(const char *arg)
{
GDBusProxy *proxy;
- char *path;
if (!arg || !strlen(arg)) {
rl_printf("Missing device address argument\n");
for (list = g_list_first(dev_list); list; list = g_list_next(list)) {
GDBusProxy *proxy = list->data;
- cmd_remove(g_dbus_proxy_get_path(proxy));
+
+ remove_device(proxy);
}
return;
return;
}
- path = g_strdup(g_dbus_proxy_get_path(proxy));
-
- if (g_dbus_proxy_method_call(default_ctrl, "RemoveDevice",
- remove_device_setup,
- remove_device_reply,
- path, g_free) == FALSE) {
- rl_printf("Failed to remove device\n");
- g_free(path);
- return;
- }
+ remove_device(proxy);
}
static void connect_reply(DBusMessage *message, void *user_data)