refactor metadata pack/unpack functions
Move the `parse` and `combine` functions, which are used to translate
between `map<string,string>` and `vector<string>` for the metadata.
This is in preparation for transitioning the AdditionalData field
from `vector` to `map`.
Tested: Test cases pass. Simple `log-create` call has no change in
behavior.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib968e1fe02903072c300d5387cf91f2d8164b1b4
diff --git a/elog_meta.cpp b/elog_meta.cpp
index 0131c2f..1b8aaea 100644
--- a/elog_meta.cpp
+++ b/elog_meta.cpp
@@ -2,6 +2,8 @@
#include "elog_meta.hpp"
+#include "util.hpp"
+
namespace phosphor
{
namespace logging
@@ -18,8 +20,7 @@
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
- std::map<std::string, std::string> metadata;
- parse(data, metadata);
+ auto metadata = util::additional_data::parse(data);
auto iter = metadata.find(match);
if (metadata.end() != iter)
{
@@ -44,8 +45,7 @@
const std::string& match, const std::vector<std::string>& data,
AssociationList& list)
{
- std::map<std::string, std::string> metadata;
- parse(data, metadata);
+ auto metadata = util::additional_data::parse(data);
auto iter = metadata.find(match);
if (metadata.end() != iter)
{