about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-26 16:54:45 -0800
committerKartik K. Agaram <vc@akkartik.com>2021-11-26 16:54:45 -0800
commit283cc7ea522302daf0cd2fefcf2eb8fe6e7e041c (patch)
tree3a916fce26603e1cf3107c17a277dd205868c1f7
parent0b365d3e4d5e4a9db125870490ceae2d3c1bb065 (diff)
downloadteliva-283cc7ea522302daf0cd2fefcf2eb8fe6e7e041c.tar.gz
eliminate tail call using goto
-rw-r--r--src/lua.c3
1 files changed, 2 insertions, 1 deletions
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;