]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
hostapd: remove unnecessary ucv_gc calls
authorFelix Fietkau <nbd@nbd.name>
Thu, 26 Jun 2025 12:36:10 +0000 (14:36 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 2 Aug 2025 14:46:59 +0000 (16:46 +0200)
They should not be needed, since the code doesn't use circular references

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 5204559d43017cafd4ea0d16f63fd83c982132db..d3eadba15a863ab0f2d227900607285acfb039fc 100644 (file)
@@ -78,8 +78,6 @@ hostapd_ucode_update_interfaces(void)
 
        ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
        ucv_object_add(ucv_prototype_get(global), "bss", if_bss);
-
-       ucv_gc(vm);
 }
 
 static uc_value_t *
@@ -331,7 +329,6 @@ uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs)
        os_free(hapd);
 
        hostapd_ucode_update_interfaces();
-       ucv_gc(vm);
 
        return NULL;
 }
@@ -780,7 +777,6 @@ int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
                ret = ucv_int64_get(cur);
 
        ucv_put(val);
-       ucv_gc(vm);
 
        return ret;
 }
@@ -906,7 +902,6 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces)
 
        if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc"))
                goto free_vm;
-       ucv_gc(vm);
 
        return 0;
 
@@ -940,7 +935,6 @@ void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type)
        uc_value_push(ucv_get(val));
        ucv_put(wpa_ucode_call(3));
        ucv_put(val);
-       ucv_gc(vm);
 }
 
 void hostapd_ucode_free_bss(struct hostapd_data *hapd)
@@ -960,7 +954,6 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd)
        ucv_put(wpa_ucode_call(2));
 
        ucv_put(val);
-       ucv_gc(vm);
 }
 
 #ifdef CONFIG_APUP
@@ -977,6 +970,5 @@ void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname)
        uc_value_push(ucv_string_new(ifname)); // APuP peer ifname
        ucv_put(wpa_ucode_call(2));
        ucv_put(val);
-       ucv_gc(vm);
 }
 #endif // def CONFIG_APUP
index a7cc2c7059cce8f6e843ebcad662e425263a0d23..b5fdf6676c264c2ed38ef9feac1efdd4fc3aefe2 100644 (file)
@@ -14,7 +14,6 @@
 
 static uc_value_t *registry;
 static uc_vm_t vm;
-static struct uloop_timeout gc_timer;
 static struct udebug ud;
 static struct udebug_buf ud_log, ud_nl[3];
 static const struct udebug_buf_meta meta_log = {
@@ -71,11 +70,6 @@ static struct udebug_ubus_ring udebug_rings[] = {
 char *udebug_service;
 struct udebug_ubus ud_ubus;
 
-static void uc_gc_timer(struct uloop_timeout *timeout)
-{
-       ucv_gc(&vm);
-}
-
 uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs)
 {
        uc_value_t *level = uc_fn_arg(0);
@@ -254,7 +248,6 @@ uc_vm_t *wpa_ucode_create_vm(void)
 
        uc_stdlib_load(uc_vm_scope_get(&vm));
        eloop_add_uloop();
-       gc_timer.cb = uc_gc_timer;
 
        return &vm;
 }
@@ -486,9 +479,6 @@ uc_value_t *wpa_ucode_call(size_t nargs)
        if (uc_vm_call(&vm, true, nargs) != EXCEPTION_NONE)
                return NULL;
 
-       if (!gc_timer.pending)
-               uloop_timeout_set(&gc_timer, 10);
-
        return uc_vm_stack_pop(&vm);
 }
 
index 8335a27e892b88ad9226fefe9a87739e0eccae3d..8ba4db01de7eaa241e82c0cd09dfea8678407a1e 100644 (file)
@@ -39,7 +39,6 @@ wpas_ucode_update_interfaces(void)
                ucv_object_add(ifs, wpa_s->ifname, wpas_ucode_iface_get_uval(wpa_s));
 
        ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
-       ucv_gc(vm);
 }
 
 void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s)
@@ -52,7 +51,6 @@ void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s)
        uc_value_push(ucv_string_new(wpa_s->ifname));
        uc_value_push(wpas_ucode_iface_get_uval(wpa_s));
        ucv_put(wpa_ucode_call(2));
-       ucv_gc(vm);
 }
 
 void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s)
@@ -71,7 +69,6 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s)
        uc_value_push(ucv_get(val));
        ucv_put(wpa_ucode_call(2));
        ucv_put(val);
-       ucv_gc(vm);
 }
 
 void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
@@ -91,7 +88,6 @@ void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
        uc_value_push(ucv_get(val));
        uc_value_push(ucv_string_new(state));
        ucv_put(wpa_ucode_call(3));
-       ucv_gc(vm);
 }
 
 void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
@@ -124,7 +120,6 @@ void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_d
        }
 
        ucv_put(wpa_ucode_call(4));
-       ucv_gc(vm);
 }
 
 static const char *obj_stringval(uc_value_t *obj, const char *name)
@@ -310,7 +305,6 @@ int wpas_ucode_init(struct wpa_global *gl)
        if (wpa_ucode_run(HOSTAPD_UC_PATH "wpa_supplicant.uc"))
                goto free_vm;
 
-       ucv_gc(vm);
        return 0;
 
 free_vm: