Skip to content

Commit

Permalink
libuci-lua-53: fix each method
Browse files Browse the repository at this point in the history
Fix the issue iterate the first element twice.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Jul 17, 2024
1 parent c42cde8 commit 628212e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libuci-lua-53/src/uci.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ uci_lua_each_iter(lua_State *L)
if (type && (strcmp(s->type, type) != 0))
goto again;

lua_pushlightuserdata(L, tmp);
lua_replace(L, lua_upvalueindex(4));

lua_pushlightuserdata(L, e);
lua_replace(L, lua_upvalueindex(3));

lua_pushlightuserdata(L, tmp);
lua_replace(L, lua_upvalueindex(4));

lua_pushinteger(L, i);
lua_replace(L, lua_upvalueindex(5));

Expand Down Expand Up @@ -418,8 +418,8 @@ uci_lua_each(lua_State *L)
lua_pushnil(L);

lua_pushlightuserdata(L, &p->sections);
lua_pushlightuserdata(L, tmp);
lua_pushlightuserdata(L, e);
lua_pushlightuserdata(L, tmp);
lua_pushinteger(L, i);

lua_pushcclosure(L, uci_lua_each_iter, 5);
Expand Down

0 comments on commit 628212e

Please sign in to comment.