Message ID | 1516970484-15996-1-git-send-email-stefan@herbrechtsmeier.net |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] Lua: bootenv: Remove empty bootenv values from the bootloader environment and not from the dictionary | expand |
On 26/01/2018 13:41, stefan@herbrechtsmeier.net wrote: > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > --- > > corelib/lua_interface.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c > index b8492ae..78c4df4 100644 > --- a/corelib/lua_interface.c > +++ b/corelib/lua_interface.c > @@ -736,12 +736,8 @@ static int l_set_bootenv(lua_State *L) { > const char *name = luaL_checkstring(L, 1); > const char *value = luaL_checkstring(L, 2); > > - if (strlen(name)) { > - if (strlen(value)) > - dict_set_value(bootenv, name, value); > - else > - dict_remove(bootenv, name); > - } > + if (strlen(name)) > + dict_set_value(bootenv, name, value); > lua_pop(L, 2); > > return 0; > This is ok because it generates a bootloader_env_set(name, "") in case value is an empty string, and this remove the variable from the environment. Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic
On 26/01/2018 13:41, stefan@herbrechtsmeier.net wrote: > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> > --- > > corelib/lua_interface.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c > index b8492ae..78c4df4 100644 > --- a/corelib/lua_interface.c > +++ b/corelib/lua_interface.c > @@ -736,12 +736,8 @@ static int l_set_bootenv(lua_State *L) { > const char *name = luaL_checkstring(L, 1); > const char *value = luaL_checkstring(L, 2); > > - if (strlen(name)) { > - if (strlen(value)) > - dict_set_value(bootenv, name, value); > - else > - dict_remove(bootenv, name); > - } > + if (strlen(name)) > + dict_set_value(bootenv, name, value); > lua_pop(L, 2); > > return 0; > Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index b8492ae..78c4df4 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -736,12 +736,8 @@ static int l_set_bootenv(lua_State *L) { const char *name = luaL_checkstring(L, 1); const char *value = luaL_checkstring(L, 2); - if (strlen(name)) { - if (strlen(value)) - dict_set_value(bootenv, name, value); - else - dict_remove(bootenv, name); - } + if (strlen(name)) + dict_set_value(bootenv, name, value); lua_pop(L, 2); return 0;