Use json::emplace to avoid some extra calls to operator[]

This commit is contained in:
Tim Wojtulewicz 2019-09-25 16:12:50 -07:00
parent c8f2d52d91
commit d4d1009b5c
4 changed files with 12 additions and 12 deletions

View file

@ -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;
}