Fix svace 'UNREACHABLE_CODE.NO_PATH' warnings
[platform/upstream/connman.git] / src / technology.c
index b358600..440d7eb 100644 (file)
@@ -589,6 +589,37 @@ static void append_devices(DBusMessageIter *iter, void *user_data)
                                DBUS_TYPE_STRING, &str);
        }
 }
+
+void __connman_technology_append_interfaces(DBusMessageIter *array,
+                               enum connman_service_type type, const char *ifname)
+{
+       GSList *list;
+       struct connman_technology *technology = NULL;
+
+       for (list = technology_list; list; list = list->next) {
+               struct connman_technology *local_tech = list->data;
+
+               if (local_tech->type != type)
+                       continue;
+
+               technology = local_tech;
+               break;
+       }
+
+       if (!technology)
+               return;
+
+       for (list = technology->device_list; list; list = list->next) {
+               struct connman_device *device = list->data;
+               const char *str = connman_device_get_string(device, "Interface");
+
+               if (g_strcmp0(ifname, str) == 0)
+                       continue;
+
+               dbus_message_iter_append_basic(array,
+                               DBUS_TYPE_STRING, &str);
+       }
+}
 #endif
 
 static void append_properties(DBusMessageIter *iter,
@@ -1271,7 +1302,7 @@ static void reply_scan_pending_device(
        dbus_bool_t status = 0;
        connman_scan_type_e scan_type = CONNMAN_SCAN_TYPE_UNKNOWN;
 
-       DBG("technology %p ifname %d count %d", technology, ifname, count);
+       DBG("technology %p ifname %s count %d", technology, ifname, count);
 
        list = technology->scan_pending;
 
@@ -1375,9 +1406,10 @@ void __connman_technology_scan_stopped(struct connman_device *device,
        reply_scan_pending_device(technology, ifname, count);
 
        return;
-#endif
+#else
        if (count == 0)
                reply_scan_pending(technology, 0);
+#endif
 }
 
 void __connman_technology_notify_regdom_by_device(struct connman_device *device,
@@ -1755,45 +1787,6 @@ static DBusMessage *get_max_scan_ssid(DBusConnection *conn, DBusMessage *msg, vo
        return reply;
 }
 
-static DBusMessage *get_interfaces(DBusConnection *conn, DBusMessage *msg, void *data)
-{
-       DBusMessage *reply;
-       DBusMessageIter iter, array;
-       GSList *list;
-       struct connman_technology *technology = data;
-       const char *default_interface = connman_option_get_string("DefaultWifiInterface");
-
-       DBG("technology %p", technology);
-
-       reply = dbus_message_new_method_return(msg);
-       if (!reply)
-               return NULL;
-
-       if (technology->type != CONNMAN_SERVICE_TYPE_WIFI)
-               return NULL;
-
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-                                       DBUS_TYPE_STRING_AS_STRING, &array);
-
-       dbus_message_iter_append_basic(&array,
-                               DBUS_TYPE_STRING, &default_interface);
-
-       for (list = technology->device_list; list; list = list->next) {
-               struct connman_device *device = list->data;
-               const char *str = connman_device_get_string(device, "Interface");
-
-               if (g_strcmp0(default_interface, str) == 0)
-                       continue;
-
-               dbus_message_iter_append_basic(&array,
-                                               DBUS_TYPE_STRING, &str);
-       }
-
-       dbus_message_iter_close_container(&iter, &array);
-       return reply;
-}
-
 static int technology_enable_device(struct connman_technology *technology,
                                bool enable_device, const char *ifname, struct connman_device **device_out)
 {
@@ -2497,8 +2490,6 @@ static const GDBusMethodTable technology_methods[] = {
                        get_5ghz_supported) },
        { GDBUS_METHOD("GetMaxScanSsid", NULL, GDBUS_ARGS({ "maxscanssid", "a{sv}" }),
                        get_max_scan_ssid) },
-       { GDBUS_METHOD("GetInterfaces", NULL, GDBUS_ARGS({ "interface_list", "as" }),
-                       get_interfaces) },
        { GDBUS_ASYNC_METHOD("SetDevicePower",
                        GDBUS_ARGS({ "ifname", "s" }, { "value", "b" }),
                        NULL, set_device_power) },