gluon-web-wifi-config: rename and simplify filter_active_interfaces()

- Return early
- Rename to has_active_interfaces(), as it returns a boolean
This commit is contained in:
Matthias Schiffer 2020-06-06 16:48:26 +02:00
parent 600ab99f80
commit 53c33acaf9
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -71,14 +71,13 @@ uci:foreach('wireless', 'wifi-device', function(config)
return out return out
end end
local function filter_active_interfaces(interfaces) local function has_active_interfaces(interfaces)
local out = false
for _, interface in ipairs(interfaces) do for _, interface in ipairs(interfaces) do
if not uci:get_bool('wireless', interface .. '_' .. radio, 'disabled') then if not uci:get_bool('wireless', interface .. '_' .. radio, 'disabled') then
out = true return true
end end
end end
return out return false
end end
local function vif_option(name, interfaces, msg) local function vif_option(name, interfaces, msg)
@ -89,7 +88,7 @@ uci:foreach('wireless', 'wifi-device', function(config)
end end
local o = p:option(Flag, radio .. '_' .. name .. '_enabled', msg) local o = p:option(Flag, radio .. '_' .. name .. '_enabled', msg)
o.default = filter_active_interfaces(existing_interfaces) o.default = has_active_interfaces(existing_interfaces)
function o:write(data) function o:write(data)
for _, interface in ipairs(existing_interfaces) do for _, interface in ipairs(existing_interfaces) do