From ed5efcd8a091376e96760ae5e2f103b92eb8d572 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 16 Mar 2022 20:31:43 -0700 Subject: drop a forward decl --- src/teliva.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/teliva.c b/src/teliva.c index 549d99b..1bc06d5 100644 --- a/src/teliva.c +++ b/src/teliva.c @@ -320,14 +320,6 @@ void append_string_to_array(lua_State* L, int array_index, const char* s) { lua_rawseti(L, array_index, new_index); } -static void save_caller_as(lua_State* L, const char* name, const char* caller_name); -void save_caller(lua_State* L, const char* name, int call_graph_depth) { - lua_Debug ar; - lua_getstack(L, 1, &ar); - lua_getinfo(L, "n", &ar); - if (ar.name) save_caller_as(L, name, ar.name); -} - static void save_caller_as(lua_State* L, const char* name, const char* caller_name) { // push table of caller tables luaL_newmetatable(L, "__teliva_caller"); @@ -349,6 +341,13 @@ static void save_caller_as(lua_State* L, const char* name, const char* caller_na lua_pop(L, 1); // table of caller tables } +void save_caller(lua_State* L, const char* name, int call_graph_depth) { + lua_Debug ar; + lua_getstack(L, 1, &ar); + lua_getinfo(L, "n", &ar); + if (ar.name) save_caller_as(L, name, ar.name); +} + static void clear_caller(lua_State* L) { int oldtop = lua_gettop(L); luaL_newmetatable(L, "__teliva_caller"); -- cgit 1.4.1-2-gfad0