mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Improve how primary/top-level BIFs get initialized
This commit is contained in:
parent
1bbae2368d
commit
4a8640d702
6 changed files with 67 additions and 52 deletions
|
@ -62,6 +62,7 @@ extern "C" {
|
|||
#include "broker/Manager.h"
|
||||
|
||||
#include "binpac_zeek.h"
|
||||
#include "module_util.h"
|
||||
|
||||
#include "3rdparty/sqlite3.h"
|
||||
|
||||
|
@ -388,8 +389,7 @@ static std::vector<std::string> get_script_signature_files()
|
|||
return rval;
|
||||
}
|
||||
|
||||
SetupResult setup(int argc, char** argv,
|
||||
Options* zopts)
|
||||
SetupResult setup(int argc, char** argv, Options* zopts)
|
||||
{
|
||||
ZEEK_LSAN_DISABLE();
|
||||
std::set_new_handler(bro_new_handler);
|
||||
|
@ -628,6 +628,19 @@ SetupResult setup(int argc, char** argv,
|
|||
HeapLeakChecker::Disabler disabler;
|
||||
#endif
|
||||
|
||||
auto ipbid = install_ID("__init_primary_bifs", GLOBAL_MODULE_NAME,
|
||||
true, true);
|
||||
auto ipbft = make_intrusive<FuncType>(make_intrusive<RecordType>(nullptr),
|
||||
base_type(TYPE_BOOL),
|
||||
FUNC_FLAVOR_FUNCTION);
|
||||
ipbid->SetType(std::move(ipbft));
|
||||
auto init_bifs = [](Frame* frame, const Args* args) -> BifReturnVal
|
||||
{
|
||||
init_primary_bifs();
|
||||
return val_mgr->True();
|
||||
};
|
||||
auto ipbb = make_intrusive<BuiltinFunc>(init_bifs, ipbid->Name(), false);
|
||||
|
||||
run_state::is_parsing = true;
|
||||
yyparse();
|
||||
run_state::is_parsing = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue