mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Use json::emplace to avoid some extra calls to operator[]
This commit is contained in:
parent
c8f2d52d91
commit
d4d1009b5c
4 changed files with 12 additions and 12 deletions
|
@ -37,7 +37,7 @@ bool JSON::Describe(ODesc* desc, int num_fields, const Field* const * fields,
|
|||
if ( new_entry.is_null() )
|
||||
return false;
|
||||
|
||||
j[fields[i]->name] = new_entry;
|
||||
j.emplace(fields[i]->name, new_entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,11 +182,7 @@ ZeekJson JSON::BuildJSON(Value* val, const string& name) const
|
|||
}
|
||||
|
||||
if ( ! name.empty() && ! j.is_null() )
|
||||
{
|
||||
ZeekJson j2 = ZeekJson::object();
|
||||
j2[name] = j;
|
||||
return j2;
|
||||
}
|
||||
return { { name, j } };
|
||||
|
||||
return j;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue