static -> inline
Declaring a function static in a header makes no sense, because a header
isn't a compile unit. Find all the issues and replace them with inline.
Change-Id: Icfc2b72d94b41a3a880da1ae6975beaa30a6792b
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 08ff2b6..e2fa8db 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -80,8 +80,7 @@
retry
};
-static inline boost::system::error_code
- defaultRetryHandler(unsigned int respCode)
+inline boost::system::error_code defaultRetryHandler(unsigned int respCode)
{
// As a default, assume 200X is alright
BMCWEB_LOG_DEBUG("Using default check for response code validity");
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 78d6819..0a4ea4a 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -163,8 +163,8 @@
propertyName);
}
-static inline void addPrefixToStringItem(std::string& strValue,
- std::string_view prefix)
+inline void addPrefixToStringItem(std::string& strValue,
+ std::string_view prefix)
{
// Make sure the value is a properly formatted URI
auto parsed = boost::urls::parse_relative_ref(strValue);
@@ -246,8 +246,7 @@
}
}
-static inline void addPrefixToItem(nlohmann::json& item,
- std::string_view prefix)
+inline void addPrefixToItem(nlohmann::json& item, std::string_view prefix)
{
std::string* strValue = item.get_ptr<std::string*>();
if (strValue == nullptr)
@@ -262,9 +261,9 @@
item = *strValue;
}
-static inline void addAggregatedHeaders(crow::Response& asyncResp,
- const crow::Response& resp,
- std::string_view prefix)
+inline void addAggregatedHeaders(crow::Response& asyncResp,
+ const crow::Response& resp,
+ std::string_view prefix)
{
if (!resp.getHeaderValue("Content-Type").empty())
{
@@ -292,8 +291,8 @@
}
// Fix HTTP headers which appear in responses from Task resources among others
-static inline void
- addPrefixToHeadersInResp(nlohmann::json& json, std::string_view prefix)
+inline void addPrefixToHeadersInResp(nlohmann::json& json,
+ std::string_view prefix)
{
// The passed in "HttpHeaders" should be an array of headers
nlohmann::json::array_t* array = json.get_ptr<nlohmann::json::array_t*>();
@@ -325,7 +324,7 @@
// Search the json for all URIs and add the supplied prefix if the URI is for
// an aggregated resource.
-static inline void addPrefixes(nlohmann::json& json, std::string_view prefix)
+inline void addPrefixes(nlohmann::json& json, std::string_view prefix)
{
nlohmann::json::object_t* object =
json.get_ptr<nlohmann::json::object_t*>();
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index e90f749..68b7ff5 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -148,7 +148,7 @@
* @param[in] type Issuer/Subject
* @return None
*/
-static void updateCertIssuerOrSubject(nlohmann::json& out,
+inline void updateCertIssuerOrSubject(nlohmann::json& out,
std::string_view value)
{
// example: O=openbmc-project.xyz,CN=localhost
@@ -213,7 +213,7 @@
* @param[in] countPtr Json pointer to the count in asyncResp
* @return None
*/
-static void getCertificateList(
+inline void getCertificateList(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& basePath, const nlohmann::json::json_pointer& listPtr,
const nlohmann::json::json_pointer& countPtr)
@@ -289,7 +289,7 @@
* @param[in] name name of the certificate
* @return None
*/
-static void getCertificateProperties(
+inline void getCertificateProperties(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& objectPath, const std::string& service,
const std::string& certId, const boost::urls::url& certURL,
@@ -379,7 +379,7 @@
});
}
-static void
+inline void
deleteCertificate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service,
const sdbusplus::message::object_path& objectPath)
@@ -585,7 +585,7 @@
* @param[in] csrObjPath CSR D-Bus object path
* @return None
*/
-static void getCSR(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+inline void getCSR(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& certURI, const std::string& service,
const std::string& certObjPath,
const std::string& csrObjPath)
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 62494a8..28b995e 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -167,7 +167,7 @@
return !(fanName.empty() || fanName != fanId);
}
-static inline void handleFanPath(
+inline void handleFanPath(
const std::string& fanId,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const dbus::utility::MapperGetSubTreePathsResponse& fanPaths,
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index f9a68e7..1858c6d 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -164,7 +164,7 @@
return true;
}
-static bool
+inline bool
getRedfishLogFiles(std::vector<std::filesystem::path>& redfishLogFiles)
{
static const std::filesystem::path redfishLogDir = "/var/log";
@@ -2736,7 +2736,7 @@
});
}
-static void
+inline void
logCrashdumpEntry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& logID, nlohmann::json& logEntryJson)
{
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 3d7f115..f0b2f23 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -41,7 +41,7 @@
static constexpr std::array<std::string_view, 1> pcieSlotInterface = {
"xyz.openbmc_project.Inventory.Item.PCIeSlot"};
-static inline void handlePCIeDevicePath(
+inline void handlePCIeDevicePath(
const std::string& pcieDeviceId,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const dbus::utility::MapperGetSubTreePathsResponse& pcieDevicePaths,
@@ -78,7 +78,7 @@
messages::resourceNotFound(asyncResp->res, "PCIeDevice", pcieDeviceId);
}
-static inline void getValidPCIeDevicePath(
+inline void getValidPCIeDevicePath(
const std::string& pcieDeviceId,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::function<void(const std::string& pcieDevicePath,
@@ -102,7 +102,7 @@
});
}
-static inline void handlePCIeDeviceCollectionGet(
+inline void handlePCIeDeviceCollectionGet(
crow::App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& systemName)
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 75ec8b9..fea45e9 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -965,7 +965,7 @@
* in recursive calls to this function.
*/
template <typename Callback>
-static void getInventoryItemsData(
+void getInventoryItemsData(
std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp,
std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
std::shared_ptr<std::set<std::string>> invConnections, Callback&& callback,
@@ -1054,7 +1054,7 @@
* @param callback Callback to invoke when connections have been obtained.
*/
template <typename Callback>
-static void getInventoryItemsConnections(
+void getInventoryItemsConnections(
const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::shared_ptr<std::vector<InventoryItem>>& inventoryItems,
Callback&& callback)
@@ -1137,7 +1137,7 @@
* @param callback Callback to invoke when inventory items have been obtained.
*/
template <typename Callback>
-static void getInventoryItemAssociations(
+void getInventoryItemAssociations(
const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
const std::shared_ptr<std::set<std::string>>& sensorNames,
Callback&& callback)
@@ -1670,7 +1670,7 @@
* @param callback Callback to invoke when inventory items have been obtained.
*/
template <typename Callback>
-static void
+inline void
getInventoryItems(std::shared_ptr<SensorsAsyncResp> sensorsAsyncResp,
const std::shared_ptr<std::set<std::string>> sensorNames,
Callback&& callback)
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 161cb6a..6f84524 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -605,7 +605,7 @@
});
}
-static void addAllDriveInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+inline void addAllDriveInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& connectionName,
const std::string& path,
const std::vector<std::string>& interfaces)
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 538b261..7f57e8d 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -243,7 +243,7 @@
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
-static void
+inline void
softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
sdbusplus::message_t& m, task::Payload&& payload)
{