* 'intrusive_ptr' of https://github.com/MaxKellermann/zeek: (32 commits)
  Scope: store IntrusivePtr in `local`
  Scope: pass IntrusivePtr to AddInit()
  DNS_Mgr: use class IntrusivePtr
  Scope: use class IntrusivePtr
  Attr: use class IntrusivePtr
  Expr: check_and_promote_expr() returns IntrusivePtr
  Frame: use class IntrusivePtr
  Val: RecordVal::LookupWithDefault() returns IntrusivePtr
  Type: RecordType::FieldDefault() returns IntrusivePtr
  Val: TableVal::Delete() returns IntrusivePtr
  Type: base_type() returns IntrusivePtr
  Type: init_type() returns IntrusivePtr
  Type: merge_types() returns IntrusivePtr
  Type: use class IntrusivePtr in VectorType
  Type: use class IntrusivePtr in EnumType
  Type: use class IntrusivePtr in FileType
  Type: use class IntrusivePtr in TypeDecl
  Type: make TypeDecl `final` and the dtor non-`virtual`
  Type: use class IntrusivePtr in TypeType
  Type: use class IntrusivePtr in FuncType
  ...
This commit is contained in:
Jon Siwek 2020-03-17 22:51:46 -07:00
commit b62727a7fa
108 changed files with 1737 additions and 2067 deletions

View file

@ -145,7 +145,7 @@ RuleConditionEval::RuleConditionEval(const char* func)
rules_error("eval function type must yield a 'bool'", func);
TypeList tl;
tl.Append(internal_type("signature_state")->Ref());
tl.Append({NewRef{}, internal_type("signature_state")});
tl.Append(base_type(TYPE_STRING));
if ( ! f->CheckArgs(tl.Types()) )
@ -175,24 +175,16 @@ bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,
else
args.push_back(val_mgr->GetEmptyString());
bool result = 0;
bool result = false;
try
{
Val* val = id->ID_Val()->AsFunc()->Call(&args);
if ( val )
{
result = val->AsBool();
Unref(val);
}
else
result = false;
auto val = id->ID_Val()->AsFunc()->Call(&args);
result = val && val->AsBool();
}
catch ( InterpreterException& e )
{
result = false;
}
return result;