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

Function reset_sp

lua/sp.c:3106–3146  ·  view source on GitHub ↗

SP ready to run again

Source from the content-addressed store, hash-verified

3104
3105// SP ready to run again
3106static void reset_sp(SP sp)
3107{
3108 if (!sp) return;
3109 if (sp->lua) {
3110 lua_gc(sp->lua, LUA_GCCOLLECT, 0);
3111 drop_temp_tables(sp);
3112 }
3113 sp->can_consume = 0;
3114 sp->in_parent_trans = 0;
3115 sp->make_parent_trans = 0;
3116 if (sp->parent == sp) {
3117 if (sp->clntname) {
3118 for (int i = 0; i < sp->ntypes; ++i) {
3119 free(sp->clntname[i]);
3120 sp->clntname[i] = NULL;
3121 }
3122 free(sp->clntname);
3123 sp->clntname = NULL;
3124 }
3125 free(sp->clnttype);
3126 sp->clnttype = NULL;
3127 }
3128 free_tmptbls(sp);
3129 if (sp->buf) {
3130 free(sp->buf);
3131 sp->buf = NULL;
3132 }
3133 if (sp->error) {
3134 free(sp->error);
3135 sp->error = NULL;
3136 }
3137 sp->consumer = NULL;
3138 sp->pingpong = 0;
3139 sp->ntypes = 0;
3140 sp->bufsz = 0;
3141 sp->rc = 0;
3142 sp->num_instructions = 0;
3143 sp->max_num_instructions = gbl_max_lua_instructions;
3144 LIST_INIT(&sp->dbstmts);
3145 LIST_INIT(&sp->tmptbls);
3146}
3147
3148static void free_spversion(SP sp)
3149{

Callers 6

close_sp_intFunction · 0.85
push_argsFunction · 0.85
lua_finalFunction · 0.85
lua_funcFunction · 0.85
exec_procedureFunction · 0.85

Calls 4

lua_gcFunction · 0.85
drop_temp_tablesFunction · 0.85
freeFunction · 0.85
free_tmptblsFunction · 0.85

Tested by

no test coverage detected