Skip to content

Commit 1780d58

Browse files
Darleleta-denoyelle
authored andcommitted
CLEANUP: hlua: use hlua_pusherror() where relevant
In hlua_map_new(), when error occurs we use a combination of luaL_where, lua_pushfstring and lua_concat to build the error string before calling lua_error(). It turns out that we already have the hlua_pusherror() macro which is exactly made for that purpose so let's use it. It could be backported to all stable versions to ease code maintenance. (cherry picked from commit 6e48499) Signed-off-by: Amaury Denoyelle <[email protected]>
1 parent 30fb3ca commit 1780d58

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/hlua.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,9 +2369,7 @@ __LJMP static int hlua_map_new(struct lua_State *L)
23692369
/* error case: we can't use luaL_error because we must
23702370
* free the err variable.
23712371
*/
2372-
luaL_where(L, 1);
2373-
lua_pushfstring(L, "'new': %s.", err);
2374-
lua_concat(L, 2);
2372+
hlua_pusherror(L, "'new': %s.", err);
23752373
free(err);
23762374
chunk_destroy(&args[0].data.str);
23772375
WILL_LJMP(lua_error(L));

0 commit comments

Comments
 (0)