hostapd: clean-up references to local variables

Remove extra ucv_get calls when passing a referenced value to an object
without using it further.

Signed-off-by: Matthew Cather <mattbob4@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Matthew Cather 2025-03-03 13:40:39 -06:00 committed by Felix Fietkau
parent f79968ee0f
commit 22eaf18647
3 changed files with 7 additions and 6 deletions

View File

@ -59,7 +59,7 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u
ucv_array_set(list, i, ucv_string_new(hapd->conf->iface)); ucv_array_set(list, i, ucv_string_new(hapd->conf->iface));
ucv_object_add(bss, hapd->conf->iface, ucv_get(val)); ucv_object_add(bss, hapd->conf->iface, ucv_get(val));
} }
ucv_object_add(if_bss, iface->phy, ucv_get(list)); ucv_object_add(if_bss, iface->phy, list);
} }
static void static void
@ -77,9 +77,10 @@ hostapd_ucode_update_interfaces(void)
hostapd_ucode_update_bss_list(iface, if_bss, bss); hostapd_ucode_update_bss_list(iface, if_bss, bss);
} }
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
ucv_object_add(ucv_prototype_get(global), "interface_bss", ucv_get(if_bss)); ucv_object_add(ucv_prototype_get(global), "interface_bss", if_bss);
ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss)); ucv_object_add(ucv_prototype_get(global), "bss", bss);
ucv_gc(vm); ucv_gc(vm);
} }

View File

@ -426,7 +426,7 @@ uc_value_t *wpa_ucode_global_init(const char *name, uc_resource_type_t *global_t
uc_vm_registry_set(&vm, "hostap.global", global); uc_vm_registry_set(&vm, "hostap.global", global);
proto = ucv_prototype_get(global); proto = ucv_prototype_get(global);
ucv_object_add(proto, "data", ucv_get(ucv_object_new(&vm))); ucv_object_add(proto, "data", ucv_object_new(&vm));
#define ADD_CONST(x) ucv_object_add(proto, #x, ucv_int64_new(x)) #define ADD_CONST(x) ucv_object_add(proto, #x, ucv_int64_new(x))
ADD_CONST(MSG_EXCESSIVE); ADD_CONST(MSG_EXCESSIVE);

View File

@ -38,7 +38,7 @@ wpas_ucode_update_interfaces(void)
for (wpa_s = wpa_global->ifaces; wpa_s; wpa_s = wpa_s->next) for (wpa_s = wpa_global->ifaces; wpa_s; wpa_s = wpa_s->next)
ucv_object_add(ifs, wpa_s->ifname, ucv_get(wpas_ucode_iface_get_uval(wpa_s))); ucv_object_add(ifs, wpa_s->ifname, ucv_get(wpas_ucode_iface_get_uval(wpa_s)));
ucv_object_add(ucv_prototype_get(global), "interfaces", ucv_get(ifs)); ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
ucv_gc(vm); ucv_gc(vm);
} }