scan.l: Remove "constant" did_module_restore logic

Doesn't seem like did_module_restore has any effect on the code flow.
This commit is contained in:
Arne Welzel 2020-05-31 17:12:04 +02:00 committed by Jon Siwek
parent d15dd37b84
commit 93e7f40b70

View file

@ -592,9 +592,6 @@ static int load_files(const char* orig_file)
assert(rc == -1); // No plugin in charge of this file. assert(rc == -1); // No plugin in charge of this file.
// Whether we pushed on a FileInfo that will restore the
// current module after the final file has been scanned.
bool did_module_restore = false;
FILE* f = 0; FILE* f = 0;
if ( streq(orig_file, "-") ) if ( streq(orig_file, "-") )
@ -644,18 +641,9 @@ static int load_files(const char* orig_file)
LoadPolicyFileText(file_path.c_str()); LoadPolicyFileText(file_path.c_str());
} }
// Remember where we were. If this is the first // Remember where we were to restore the module scope in which
// file being pushed on the stack, i.e., the *last* // this @load was done when we're finished processing it.
// one that will be processed, then we want to file_stack.push_back(new FileInfo(zeek::detail::current_module));
// restore the module scope in which this @load
// was done when we're finished processing it.
if ( ! did_module_restore )
{
file_stack.push_back(new FileInfo(zeek::detail::current_module));
did_module_restore = true;
}
else
file_stack.push_back(new FileInfo);
zeekygen_mgr->Script(file_path); zeekygen_mgr->Script(file_path);