summaryrefslogtreecommitdiff
path: root/redfish-core/lib/task.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-07-09 21:17:36 +0300
committerEd Tanous <ed@tanous.net>2022-09-12 19:42:37 +0300
commit613dabea03cd2f5cb999be37aaf539280c63ea7a (patch)
treefbf586118f079918883c97caec8b1b8fd43967f1 /redfish-core/lib/task.hpp
parent188cb6294105a045a445619415d01843de8c3732 (diff)
downloadbmcweb-613dabea03cd2f5cb999be37aaf539280c63ea7a.tar.xz
Remove nlohmann brace initialization
There's a few last places (outside of tests) where we still use nlohmann brace initialization. Per the transforms we've been doing, move these to constructing the objects explicitly, using operator[], nlohmann::object_t and nlohmann::array_t. Theses were found by manual inspection grepping for all uses of nlohmann::json. This is done to reduce binary size and reduce the number of intermediate objects being constructed. This commit saves a trivial amount of size (~4KB, Half a percent of total) and in addition but makes our construction consistent. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7478479a9fdc41b254eef325002d413c1fb411a0
Diffstat (limited to 'redfish-core/lib/task.hpp')
-rw-r--r--redfish-core/lib/task.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index b40d522d46..fe3b9908bb 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -448,9 +448,10 @@ inline void requestRoutesTaskCollection(App& app)
{
continue; // shouldn't be possible
}
- members.emplace_back(
- nlohmann::json{{"@odata.id", "/redfish/v1/TaskService/Tasks/" +
- std::to_string(task->index)}});
+ nlohmann::json::object_t member;
+ member["@odata.id"] =
+ "redfish/v1/TaskService/Tasks/" + std::to_string(task->index);
+ members.emplace_back(std::move(member));
}
});
}