hostapd: clean-up references to local variables
authorMatthew Cather <mattbob4@gmail.com>
Mon, 3 Mar 2025 19:40:39 +0000 (13:40 -0600)
committerFelix Fietkau <nbd@nbd.name>
Wed, 5 Mar 2025 07:03:00 +0000 (08:03 +0100)
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>
package/network/services/hostapd/src/src/ap/ucode.c
package/network/services/hostapd/src/src/utils/ucode.c
package/network/services/hostapd/src/wpa_supplicant/ucode.c

index ede606b6b33d68492d8e85cbb46cb49e9c990cce..ff2d3ab55719e2738189c9db6e58530041b04e81 100644 (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_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
@@ -77,9 +77,10 @@ hostapd_ucode_update_interfaces(void)
                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), "interface_bss", ucv_get(if_bss));
-       ucv_object_add(ucv_prototype_get(global), "bss", ucv_get(bss));
+       ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
+       ucv_object_add(ucv_prototype_get(global), "interface_bss", if_bss);
+       ucv_object_add(ucv_prototype_get(global), "bss", bss);
+
        ucv_gc(vm);
 }
 
index 7ce121ee1ebbf26536a87605daa1bad9eee9ce0b..c5b7e39a0ef4530b949cdb80692734c681e69469 100644 (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);
        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))
        ADD_CONST(MSG_EXCESSIVE);
index 31427c39a175413fa567d3f26bd819ace9f0dfb5..bef7552873e3272560affd4cd59219687501700d 100644 (file)
@@ -38,7 +38,7 @@ wpas_ucode_update_interfaces(void)
        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(ucv_prototype_get(global), "interfaces", ucv_get(ifs));
+       ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
        ucv_gc(vm);
 }