mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use Json::StaticString for field names
Clean up some code relating to unknown fields and avoid allocate/copy/free cycles for Json objects containing serialized field names.
This commit is contained in:
@@ -658,17 +658,10 @@ Json::Value STObject::getJson (int options) const
|
||||
{
|
||||
Json::Value ret (Json::objectValue);
|
||||
|
||||
// TODO(tom): this variable is never changed...?
|
||||
int index = 1;
|
||||
for (auto const& elem : v_)
|
||||
{
|
||||
if (elem->getSType () != STI_NOTPRESENT)
|
||||
{
|
||||
auto const& n = elem->getFName ();
|
||||
auto key = n.hasName () ? std::string(n.getJsonName ()) :
|
||||
std::to_string (index);
|
||||
ret[key] = elem->getJson (options);
|
||||
}
|
||||
ret [elem->getFName().getJsonName()] = elem->getJson (options);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user