mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Don't allocate a value during a loop if avoidable
This commit is contained in:
parent
f2a6ad63ed
commit
91f05f19ef
1 changed files with 2 additions and 2 deletions
|
@ -2240,7 +2240,6 @@ bool AssignExpr::TypeCheckArithmetics(TypeTag bt1, TypeTag bt2)
|
||||||
{
|
{
|
||||||
Warn("dangerous assignment of integer to count");
|
Warn("dangerous assignment of integer to count");
|
||||||
op2 = make_intrusive<ArithCoerceExpr>(std::move(op2), bt1);
|
op2 = make_intrusive<ArithCoerceExpr>(std::move(op2), bt1);
|
||||||
bt2 = op2->Type()->Tag();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assignment of count to counter or vice
|
// Assignment of count to counter or vice
|
||||||
|
@ -3658,6 +3657,8 @@ IntrusivePtr<Val> RecordCoerceExpr::InitVal(const BroType* t, IntrusivePtr<Val>
|
||||||
IntrusivePtr<Val> RecordCoerceExpr::Fold(Val* v) const
|
IntrusivePtr<Val> RecordCoerceExpr::Fold(Val* v) const
|
||||||
{
|
{
|
||||||
auto val = make_intrusive<RecordVal>(Type()->AsRecordType());
|
auto val = make_intrusive<RecordVal>(Type()->AsRecordType());
|
||||||
|
RecordType* val_type = val->Type()->AsRecordType();
|
||||||
|
|
||||||
RecordVal* rv = v->AsRecordVal();
|
RecordVal* rv = v->AsRecordVal();
|
||||||
|
|
||||||
for ( int i = 0; i < map_size; ++i )
|
for ( int i = 0; i < map_size; ++i )
|
||||||
|
@ -3685,7 +3686,6 @@ IntrusivePtr<Val> RecordCoerceExpr::Fold(Val* v) const
|
||||||
}
|
}
|
||||||
|
|
||||||
BroType* rhs_type = rhs->Type();
|
BroType* rhs_type = rhs->Type();
|
||||||
RecordType* val_type = val->Type()->AsRecordType();
|
|
||||||
BroType* field_type = val_type->FieldType(i);
|
BroType* field_type = val_type->FieldType(i);
|
||||||
|
|
||||||
if ( rhs_type->Tag() == TYPE_RECORD &&
|
if ( rhs_type->Tag() == TYPE_RECORD &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue