MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / precompile_lua

Function precompile_lua

lua/luautil.c:67–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67int precompile_lua(char *lua_buffer, void **compiled_data, int *size) {
68 lua_State *lua;
69 Proto *f;
70 lua=lua_open();
71 luaL_loadstring(lua,lua_buffer);
72 lua_atpanic(lua, l_panic);
73 const Closure* c=(const Closure*)lua_topointer(lua,-1);
74 if (c) {
75 f = c->l.p;
76 } else {
77 return -1;
78 }
79 luaU_dump(lua,f,lua_writer1,size, 0);
80 *compiled_data = malloc(*size);
81 void *data = NULL;
82 data = *compiled_data;
83 luaU_dump(lua,f,lua_writer2,&data, 0);
84 return 0;
85}
86
87const char *luabb_pushfstring(lua_State *lua, char *fmt, ...) {
88 char c[1];

Callers

nothing calls this directly

Calls 3

lua_topointerFunction · 0.85
luaU_dumpFunction · 0.85
mallocFunction · 0.85

Tested by

no test coverage detected