const int ret = l_ffi_modcb(L, module);
lua_pop(L, 1); /* the module's table */
- /* Free the layer API wrapper (unconst it) */
- kr_layer_api_t* api = module->data;
+ const kr_layer_api_t *api = module->layer;
if (!api) {
return ret;
}
luaL_unref(L, LUA_REGISTRYINDEX, api->cb_slots[si]);
}
}
- free(api);
+ free_const(api);
return ret;
}
LAYER_REGISTER(L, api, checkout);
LAYER_REGISTER(L, api, answer_finalize);
LAYER_REGISTER(L, api, reset);
- api->data = module;
}
return api;
}
lua_getfield(L, -1, "layer");
if (!lua_isnil(L, -1)) {
module->layer = l_ffi_layer_create(L, module);
- /* most likely not needed, but compatibility for now */
- module->data = (void *)module->layer;
}
lua_pop(L, 1); /* .layer table */
* Last chance to affect what will get into the answer, including EDNS.*/
int (*answer_finalize)(kr_layer_t *ctx);
- /** The module can store anything in here.
- * In lua case we store kr_module pointer. */
+ /** The C module can store anything in here. */
void *data;
/** Internal to ./daemon/ffimodule.c. */