style: move getFRUValue into anonymous namespace

Move getFRUValue into anonymous namespace.  A later step may move this
into a global scope to enable testing, or it may be replaced by an
interface.

Change-Id: Ie4299ab713a455dd8c18b91c842ded5dfc26e85b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/writefrudata.cpp b/writefrudata.cpp
index b89e019..42ebd67 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -48,6 +48,63 @@
     return -1;
 }
 
+//------------------------------------------------------------------------
+// Gets the value of the key from the fru dictionary of the given section.
+// FRU dictionary is parsed fru data for all the sections.
+//------------------------------------------------------------------------
+std::string getFRUValue(const std::string& section, const std::string& key,
+                        const std::string& delimiter, IPMIFruInfo& fruData)
+{
+
+    auto minIndexValue = 0;
+    auto maxIndexValue = 0;
+    std::string fruValue = "";
+
+    if (section == "Board")
+    {
+        minIndexValue = OPENBMC_VPD_KEY_BOARD_MFG_DATE;
+        maxIndexValue = OPENBMC_VPD_KEY_BOARD_MAX;
+    }
+    else if (section == "Product")
+    {
+        minIndexValue = OPENBMC_VPD_KEY_PRODUCT_MFR;
+        maxIndexValue = OPENBMC_VPD_KEY_PRODUCT_MAX;
+    }
+    else if (section == "Chassis")
+    {
+        minIndexValue = OPENBMC_VPD_KEY_CHASSIS_TYPE;
+        maxIndexValue = OPENBMC_VPD_KEY_CHASSIS_MAX;
+    }
+
+    auto first = fruData.cbegin() + minIndexValue;
+    auto last = first + (maxIndexValue - minIndexValue) + 1;
+
+    auto itr =
+        std::find_if(first, last, [&key](auto& e) { return key == e.first; });
+
+    if (itr != last)
+    {
+        fruValue = itr->second;
+    }
+
+    // if the key is custom property then the value could be in two formats.
+    // 1) custom field 2 = "value".
+    // 2) custom field 2 =  "key:value".
+    // if delimiter length = 0 i.e custom field 2 = "value"
+
+    constexpr auto customProp = "Custom Field";
+    if (key.find(customProp) != std::string::npos)
+    {
+        if (delimiter.length() > 0)
+        {
+            size_t delimiterpos = fruValue.find(delimiter);
+            if (delimiterpos != std::string::npos)
+                fruValue = fruValue.substr(delimiterpos + 1);
+        }
+    }
+    return fruValue;
+}
+
 } // namespace
 
 //----------------------------------------------------------------
@@ -225,63 +282,6 @@
     return EXIT_SUCCESS;
 }
 
-//------------------------------------------------------------------------
-// Gets the value of the key from the fru dictionary of the given section.
-// FRU dictionary is parsed fru data for all the sections.
-//------------------------------------------------------------------------
-
-std::string getFRUValue(const std::string& section, const std::string& key,
-                        const std::string& delimiter, IPMIFruInfo& fruData)
-{
-
-    auto minIndexValue = 0;
-    auto maxIndexValue = 0;
-    std::string fruValue = "";
-
-    if (section == "Board")
-    {
-        minIndexValue = OPENBMC_VPD_KEY_BOARD_MFG_DATE;
-        maxIndexValue = OPENBMC_VPD_KEY_BOARD_MAX;
-    }
-    else if (section == "Product")
-    {
-        minIndexValue = OPENBMC_VPD_KEY_PRODUCT_MFR;
-        maxIndexValue = OPENBMC_VPD_KEY_PRODUCT_MAX;
-    }
-    else if (section == "Chassis")
-    {
-        minIndexValue = OPENBMC_VPD_KEY_CHASSIS_TYPE;
-        maxIndexValue = OPENBMC_VPD_KEY_CHASSIS_MAX;
-    }
-
-    auto first = fruData.cbegin() + minIndexValue;
-    auto last = first + (maxIndexValue - minIndexValue) + 1;
-
-    auto itr =
-        std::find_if(first, last, [&key](auto& e) { return key == e.first; });
-
-    if (itr != last)
-    {
-        fruValue = itr->second;
-    }
-
-    // if the key is custom property then the value could be in two formats.
-    // 1) custom field 2 = "value".
-    // 2) custom field 2 =  "key:value".
-    // if delimiter length = 0 i.e custom field 2 = "value"
-
-    constexpr auto customProp = "Custom Field";
-    if (key.find(customProp) != std::string::npos)
-    {
-        if (delimiter.length() > 0)
-        {
-            size_t delimiterpos = fruValue.find(delimiter);
-            if (delimiterpos != std::string::npos)
-                fruValue = fruValue.substr(delimiterpos + 1);
-        }
-    }
-    return fruValue;
-}
 // Get the inventory service from the mapper.
 auto getService(sdbusplus::bus::bus& bus, const std::string& intf,
                 const std::string& path)