]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
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:04:52 +0000 (08:04 +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>
(cherry picked from commit 22eaf1864731dd29918357b26565dbd9420fd314)

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 a7cbea05187214ac5fa9ff361caa468331e625f0..e1c8289c515b091d373e633b99c6051dd19a9845 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 af8614b8cb858057d379d82db693d20a49df58c0..e61cb18db0bb1fc0dfdb08b4cc189da06e83ac0c 100644 (file)
@@ -425,7 +425,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);
 }