mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-24 05:32:21 +00:00
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.
This commit is contained in:
parent
f7ae84e7d1
commit
6e484996c6
@ -2369,9 +2369,7 @@ __LJMP static int hlua_map_new(struct lua_State *L)
|
|||||||
/* error case: we can't use luaL_error because we must
|
/* error case: we can't use luaL_error because we must
|
||||||
* free the err variable.
|
* free the err variable.
|
||||||
*/
|
*/
|
||||||
luaL_where(L, 1);
|
hlua_pusherror(L, "'new': %s.", err);
|
||||||
lua_pushfstring(L, "'new': %s.", err);
|
|
||||||
lua_concat(L, 2);
|
|
||||||
free(err);
|
free(err);
|
||||||
chunk_destroy(&args[0].data.str);
|
chunk_destroy(&args[0].data.str);
|
||||||
WILL_LJMP(lua_error(L));
|
WILL_LJMP(lua_error(L));
|
||||||
|
Loading…
Reference in New Issue
Block a user