mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Avoid creating a few temporary values to avoid copy operations
This commit is contained in:
parent
3295c8f1c1
commit
1e33467844
3 changed files with 3 additions and 7 deletions
|
@ -1052,8 +1052,7 @@ void RecordType::AddField(unsigned int field, const TypeDecl* td) {
|
|||
|
||||
if ( def_expr && ! IsErrorType(type->Tag()) ) {
|
||||
if ( def_expr->Tag() == detail::EXPR_CONST ) {
|
||||
auto v = def_expr->Eval(nullptr);
|
||||
auto zv = ZVal(v, type);
|
||||
auto zv = ZVal(def_expr->Eval(nullptr), type);
|
||||
|
||||
if ( ZVal::IsManagedType(type) )
|
||||
init = std::make_unique<detail::DirectManagedFieldInit>(zv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue