From: Tim Duesterhus Date: Tue, 19 May 2020 11:49:38 +0000 (+0200) Subject: MINOR: lua: Use vars_unset_by_name_ifexist() X-Git-Tag: v2.2-dev9~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=94fa973f3ed8c6df00c1042863efda093f4e46c4;p=thirdparty%2Fhaproxy.git MINOR: lua: Use vars_unset_by_name_ifexist() 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. --- diff --git a/src/hlua.c b/src/hlua.c index ed987d50b0..b5bf646322 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -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; }