From 283cc7ea522302daf0cd2fefcf2eb8fe6e7e041c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 Nov 2021 16:54:45 -0800 Subject: eliminate tail call using goto --- src/lua.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua.c b/src/lua.c index 4c6ee62..e16872b 100644 --- a/src/lua.c +++ b/src/lua.c @@ -526,6 +526,7 @@ void draw_definition_name (const char *definition_name) { /* return true if submitted */ void big_picture (lua_State *L) { +restart: clear(); luaL_newmetatable(L, "__teliva_call_graph_depth"); int cgt = lua_gettop(L); @@ -646,7 +647,7 @@ void big_picture (lua_State *L) { return; } else if (c == ENTER) { int back_to_big_picture = edit_image(L, query); - if (back_to_big_picture) big_picture(L); // retry while leaking stack + if (back_to_big_picture) goto restart; return; } else if (c == CTRL_U) { qlen = 0; -- cgit 1.4.1-2-gfad0