Move ID to the zeek::detail namespace

This commit is contained in:
Tim Wojtulewicz 2020-05-18 18:16:25 -07:00
parent 9992ec5c11
commit 0d623d003c
30 changed files with 221 additions and 182 deletions

View file

@ -30,13 +30,13 @@ using namespace std;
//
// Helper routines
//
bool string_is_regex(const string& s)
static bool string_is_regex(const string& s)
{
return strpbrk(s.data(), "?*\\+");
}
void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,
bool func_only = false)
static void lookup_global_symbols_regex(const string& orig_regex, vector<zeek::detail::ID*>& matches,
bool func_only = false)
{
if ( streq(orig_regex.c_str(), "") )
return;
@ -61,18 +61,18 @@ void lookup_global_symbols_regex(const string& orig_regex, vector<ID*>& matches,
Scope* global = global_scope();
const auto& syms = global->Vars();
ID* nextid;
zeek::detail::ID* nextid;
for ( const auto& sym : syms )
{
ID* nextid = sym.second.get();
zeek::detail::ID* nextid = sym.second.get();
if ( ! func_only || nextid->GetType()->Tag() == TYPE_FUNC )
if ( ! regexec (&re, nextid->Name(), 0, 0, 0) )
matches.push_back(nextid);
}
}
void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
bool func_only = false)
static void choose_global_symbols_regex(const string& regex, vector<zeek::detail::ID*>& choices,
bool func_only = false)
{
lookup_global_symbols_regex(regex, choices, func_only);
@ -111,7 +111,7 @@ void choose_global_symbols_regex(const string& regex, vector<ID*>& choices,
int option = atoi(input.c_str());
if ( option > 0 && option <= (int) choices.size() )
{
ID* choice = choices[option - 1];
zeek::detail::ID* choice = choices[option - 1];
choices.clear();
choices.push_back(choice);
return;
@ -398,7 +398,7 @@ int dbg_cmd_break(DebugCmd cmd, const vector<string>& args)
vector<string> locstrings;
if ( string_is_regex(args[0]) )
{
vector<ID*> choices;
vector<zeek::detail::ID*> choices;
choose_global_symbols_regex(args[0], choices, true);
for ( unsigned int i = 0; i < choices.size(); ++i )
locstrings.push_back(choices[i]->Name());