]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua: Use vars_unset_by_name_ifexist()
authorTim Duesterhus <tim@bastelstu.be>
Tue, 19 May 2020 11:49:38 +0000 (13:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 25 May 2020 06:12:17 +0000 (08:12 +0200)
There is no good reason to register a variable name, just to unset
that value that could not even be set without the variable existing.

This change should be safe, may be backported if desired.

src/hlua.c

index ed987d50b0b93cf7e6be95b11fd1e816942d125c..b5bf646322cccc6a167371ad9acb818c04bfd4da 100644 (file)
@@ -3512,7 +3512,7 @@ __LJMP static int hlua_applet_tcp_unset_var(lua_State *L)
 
        /* Unset the variable. */
        smp_set_owner(&smp, s->be, s->sess, s, 0);
-       vars_unset_by_name(name, len, &smp);
+       vars_unset_by_name_ifexist(name, len, &smp);
        return 0;
 }
 
@@ -3990,7 +3990,7 @@ __LJMP static int hlua_applet_http_unset_var(lua_State *L)
 
        /* Unset the variable. */
        smp_set_owner(&smp, s->be, s->sess, s, 0);
-       vars_unset_by_name(name, len, &smp);
+       vars_unset_by_name_ifexist(name, len, &smp);
        return 0;
 }
 
@@ -5074,7 +5074,7 @@ __LJMP static int hlua_unset_var(lua_State *L)
 
        /* Unset the variable. */
        smp_set_owner(&smp, htxn->p, htxn->s->sess, htxn->s, htxn->dir & SMP_OPT_DIR);
-       vars_unset_by_name(name, len, &smp);
+       vars_unset_by_name_ifexist(name, len, &smp);
        return 0;
 }