summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-11-01 18:52:15 -0700
committerPatrick Venture <venture@google.com>2018-11-01 18:52:15 -0700
commit30047bf9647215951ba5dfe21ceb3e58a1b405a4 (patch)
treebbe9868b8130f57005c133b8241d62747965ccfc
parentf8d38bbebe990802ed01434fc3df5ba755eac58a (diff)
downloadphosphor-logging-30047bf9647215951ba5dfe21ceb3e58a1b405a4.tar.gz
phosphor-logging-30047bf9647215951ba5dfe21ceb3e58a1b405a4.zip
minor cleanup, std namespacing
Added std namespace to places where there is a cpp version. Change-Id: I60a05a7c9cdcd79cfffc3c4968005fcbe34acf81 Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--elog_meta.cpp4
-rw-r--r--elog_meta.hpp4
-rw-r--r--log_manager.cpp7
-rw-r--r--logging_test.cpp5
-rw-r--r--phosphor-rsyslog-config/server-conf.cpp4
-rw-r--r--test/remote_logging_test_config.cpp3
6 files changed, 17 insertions, 10 deletions
diff --git a/elog_meta.cpp b/elog_meta.cpp
index 98425d4..f2883b7 100644
--- a/elog_meta.cpp
+++ b/elog_meta.cpp
@@ -24,12 +24,12 @@ void build<xyz::openbmc_project::Common::Callout::Device::CALLOUT_DEVICE_PATH>(
if (metadata.end() != iter)
{
auto comp = [](const auto& first, const auto& second) {
- return (strcmp(std::get<0>(first), second) < 0);
+ return (std::strcmp(std::get<0>(first), second) < 0);
};
auto callout = std::lower_bound(callouts.begin(), callouts.end(),
(iter->second).c_str(), comp);
if ((callouts.end() != callout) &&
- !strcmp((iter->second).c_str(), std::get<0>(*callout)))
+ !std::strcmp((iter->second).c_str(), std::get<0>(*callout)))
{
list.emplace_back(std::make_tuple(
CALLOUT_FWD_ASSOCIATION, CALLOUT_REV_ASSOCIATION,
diff --git a/elog_meta.hpp b/elog_meta.hpp
index b44f52d..fe14a11 100644
--- a/elog_meta.hpp
+++ b/elog_meta.hpp
@@ -80,12 +80,12 @@ inline void
if (metadata.end() != iter)
{
auto comp = [](const auto& first, const auto& second) {
- return (strcmp(std::get<0>(first), second) < 0);
+ return (std::strcmp(std::get<0>(first), second) < 0);
};
auto callout = std::lower_bound(callouts.begin(), callouts.end(),
(iter->second).c_str(), comp);
if ((callouts.end() != callout) &&
- !strcmp((iter->second).c_str(), std::get<0>(*callout)))
+ !std::strcmp((iter->second).c_str(), std::get<0>(*callout)))
{
constexpr auto ROOT = "/xyz/openbmc_project/inventory";
diff --git a/log_manager.cpp b/log_manager.cpp
index ddb5a1d..3dc14d7 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -14,9 +14,12 @@
#include <chrono>
#include <cstdio>
+#include <cstring>
#include <fstream>
+#include <functional>
#include <future>
#include <iostream>
+#include <map>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/vtable.hpp>
#include <set>
@@ -90,7 +93,7 @@ void Manager::_commit(uint64_t transactionId, std::string&& errMsg,
}
constexpr const auto transactionIdVar = "TRANSACTION_ID";
// Length of 'TRANSACTION_ID' string.
- constexpr const auto transactionIdVarSize = strlen(transactionIdVar);
+ constexpr const auto transactionIdVarSize = std::strlen(transactionIdVar);
// Length of 'TRANSACTION_ID=' string.
constexpr const auto transactionIdVarOffset = transactionIdVarSize + 1;
@@ -361,7 +364,7 @@ void Manager::journalSync()
// See if a sync happened by now
std::string timestampStr;
std::getline(syncedFile, timestampStr);
- auto timestamp = stoll(timestampStr);
+ auto timestamp = std::stoll(timestampStr);
if (timestamp >= start)
{
return;
diff --git a/logging_test.cpp b/logging_test.cpp
index 3a144f8..279d02b 100644
--- a/logging_test.cpp
+++ b/logging_test.cpp
@@ -3,6 +3,7 @@
#include <getopt.h>
#include <systemd/sd-journal.h>
+#include <cstring>
#include <iostream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
@@ -202,7 +203,7 @@ int elog_test()
void commitError(const char* text)
{
- if (strcmp(text, "AutoTestSimple") == 0)
+ if (std::strcmp(text, "AutoTestSimple") == 0)
{
try
{
@@ -216,7 +217,7 @@ void commitError(const char* text)
commit(e.name());
}
}
- else if (strcmp(text, "AutoTestCreateAndCommit") == 0)
+ else if (std::strcmp(text, "AutoTestCreateAndCommit") == 0)
{
report<example::xyz::openbmc_project::Example::Elog::AutoTestSimple>(
example::xyz::openbmc_project::Example::Elog::AutoTestSimple::
diff --git a/phosphor-rsyslog-config/server-conf.cpp b/phosphor-rsyslog-config/server-conf.cpp
index 4bf167c..836e83b 100644
--- a/phosphor-rsyslog-config/server-conf.cpp
+++ b/phosphor-rsyslog-config/server-conf.cpp
@@ -13,6 +13,8 @@
#include <arpa/inet.h>
#include <netdb.h>
+#include <string>
+
namespace phosphor
{
namespace rsyslog_config
@@ -131,7 +133,7 @@ void Server::restore(const char* filePath)
std::fstream stream(filePath, std::fstream::in);
std::string line;
- getline(stream, line);
+ std::getline(stream, line);
// Ignore if line is commented
if ('#' != line.at(0))
diff --git a/test/remote_logging_test_config.cpp b/test/remote_logging_test_config.cpp
index 59feedd..a4c6207 100644
--- a/test/remote_logging_test_config.cpp
+++ b/test/remote_logging_test_config.cpp
@@ -1,6 +1,7 @@
#include "remote_logging_tests.hpp"
#include <fstream>
+#include <string>
namespace phosphor
{
@@ -13,7 +14,7 @@ std::string getConfig(const char* filePath)
{
std::fstream stream(filePath, std::fstream::in);
std::string line;
- getline(stream, line);
+ std::getline(stream, line);
return line;
}
OpenPOWER on IntegriCloud