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

Function create_sp_int

lua/sp.c:5244–5287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5242}
5243
5244static int create_sp_int(SP sp, char **err)
5245{
5246 Lua lua;
5247
5248 sp->mspace = lua_mem_init();
5249 lua = lua_newstate(lua_alloc, sp->mspace);
5250
5251 lua_setsp(lua, sp);
5252 luaL_openlibs(lua);
5253 lua_atpanic(lua, l_panic);
5254
5255 sp->lua = lua;
5256 sp->max_num_instructions = gbl_max_lua_instructions;
5257 LIST_INIT(&sp->dbstmts);
5258 LIST_INIT(&sp->tmptbls);
5259
5260 init_db_funcs(lua);
5261 init_dbtable_funcs(lua);
5262 init_dbstmt_funcs(lua);
5263 init_dbthread_funcs(lua);
5264 init_dbconsumer_funcs(lua);
5265 init_dbtypes(lua);
5266 add_thd_funcs(lua);
5267
5268 lua_newtable(lua);
5269 lua_setglobal(lua, "_SP");
5270
5271 if (!gbl_allow_lua_print) {
5272 if (luaL_dostring(lua, "function print(...) end") != 0) {
5273 *err = strdup(lua_tostring(lua, -1));
5274 close_sp_int(sp, 1);
5275 return -1;
5276 }
5277 }
5278
5279 if(!gbl_allow_lua_dynamic_libs)
5280 disable_global_variables(lua);
5281
5282 sp->had_allow_lua_dynamic_libs = gbl_allow_lua_dynamic_libs;
5283
5284 /* To be given as lrl value. */
5285 lua_sethook(lua, InstructionCountHook, LUA_MASKCOUNT, 1);
5286 return 0;
5287}
5288
5289static SP create_sp(char **err)
5290{

Callers 2

create_spFunction · 0.85
setup_sp_intFunction · 0.85

Calls 15

lua_mem_initFunction · 0.85
lua_newstateFunction · 0.85
lua_setspFunction · 0.85
luaL_openlibsFunction · 0.85
init_db_funcsFunction · 0.85
init_dbtable_funcsFunction · 0.85
init_dbstmt_funcsFunction · 0.85
init_dbthread_funcsFunction · 0.85
init_dbconsumer_funcsFunction · 0.85
init_dbtypesFunction · 0.85
add_thd_funcsFunction · 0.85
close_sp_intFunction · 0.85

Tested by

no test coverage detected