mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Switch AnalyOpt::only_func to optional<string>
Nothing of consequence; may help express meaning and memory management.
This commit is contained in:
parent
48da8b7d66
commit
81fa7f7e3d
3 changed files with 11 additions and 4 deletions
|
@ -448,7 +448,7 @@ Options parse_cmdline(int argc, char** argv)
|
|||
set_analysis_option(optarg, rval);
|
||||
break;
|
||||
case 'o':
|
||||
rval.analysis_options.only_func = util::copy_string(optarg);
|
||||
rval.analysis_options.only_func = optarg;
|
||||
break;
|
||||
case 'P':
|
||||
if ( rval.dns_mode != detail::DNS_DEFAULT )
|
||||
|
|
|
@ -28,7 +28,7 @@ void optimize_func(ScriptFunc* f, ProfileFunc* pf, ScopePtr scope_ptr,
|
|||
return;
|
||||
|
||||
if ( analysis_options.only_func &&
|
||||
! util::streq(f->Name(), analysis_options.only_func) )
|
||||
*analysis_options.only_func != f->Name() )
|
||||
return;
|
||||
|
||||
if ( analysis_options.only_func )
|
||||
|
@ -110,7 +110,11 @@ void analyze_scripts(Options& opts)
|
|||
check_env_opt("ZEEK_XFORM", analysis_options.activate);
|
||||
|
||||
if ( ! analysis_options.only_func )
|
||||
analysis_options.only_func = getenv("ZEEK_ONLY");
|
||||
{
|
||||
auto zo = getenv("ZEEK_ONLY");
|
||||
if ( zo )
|
||||
analysis_options.only_func = zo;
|
||||
}
|
||||
|
||||
if ( analysis_options.only_func )
|
||||
analysis_options.activate = true;
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include "zeek/Func.h"
|
||||
#include "zeek/Expr.h"
|
||||
#include "zeek/Scope.h"
|
||||
|
@ -25,7 +28,7 @@ struct AnalyOpt {
|
|||
bool dump_xform = false;
|
||||
|
||||
// If non-nil, then only analyze the given function/event/hook.
|
||||
const char* only_func = nullptr;
|
||||
std::optional<std::string> only_func;
|
||||
|
||||
// If true, do global inlining.
|
||||
bool inliner = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue