Simplify fillMessageArgs

The aforementioned function does a lot of reconstruction of strings as
args are filled in.  This results in the end of the string being copied
many times (N).  Replace the algorithm with one that builds a new
string, using reserve (which is good practice) and is also capable of
returning errors in the case of bad entries.  fillMessageArgs now
returns a string instead of trying to do things in place, which avoids
the initial std::string construction, so we should be net the same here.

Given this new algorithm can now detect failures in parsing (ie, trying
to parse %1 with no arguments) add unit tests for coverage of that, and
modify event manager slightly to handle errors.

Tested: Unit tests pass.  Pretty good coverage of this stuff.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I16f28a2ac78580fb35266561f5ae38078b471989
diff --git a/redfish-core/ut/registries_test.cpp b/redfish-core/ut/registries_test.cpp
index 87b92dc..95a093e 100644
--- a/redfish-core/ut/registries_test.cpp
+++ b/redfish-core/ut/registries_test.cpp
@@ -13,17 +13,13 @@
 
 TEST(FillMessageArgs, ArgsAreFilledCorrectly)
 {
-    std::string toFill("%1");
-    fillMessageArgs({{"foo"}}, toFill);
-    EXPECT_EQ(toFill, "foo");
-
-    toFill = "";
-    fillMessageArgs({}, toFill);
-    EXPECT_EQ(toFill, "");
-
-    toFill = "%1, %2";
-    fillMessageArgs({{"foo", "bar"}}, toFill);
-    EXPECT_EQ(toFill, "foo, bar");
+    EXPECT_EQ(fillMessageArgs({{"foo"}}, "%1"), "foo");
+    EXPECT_EQ(fillMessageArgs({}, ""), "");
+    EXPECT_EQ(fillMessageArgs({{"foo", "bar"}}, "%1, %2"), "foo, bar");
+    EXPECT_EQ(fillMessageArgs({{"foo"}}, "%1 bar"), "foo bar");
+    EXPECT_EQ(fillMessageArgs({}, "%1"), "");
+    EXPECT_EQ(fillMessageArgs({}, "%"), "");
+    EXPECT_EQ(fillMessageArgs({}, "%foo"), "");
 }
 } // namespace
-} // namespace redfish::registries
\ No newline at end of file
+} // namespace redfish::registries