Commit 075eef9a authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1704] style matters: don't omit {}, func name convention, typo.

also use unnamed namespace instead of file-scope static.  technically, this
use of static was deprecated in C++.  also use the unnamed namespace for
the entire TESTs, which is our common (though not explicitly documented)
convention.
parent 2e95197a
...@@ -113,8 +113,9 @@ void ...@@ -113,8 +113,9 @@ void
LoggerImpl::setInterprocessSync(isc::util::InterprocessSync* sync) { LoggerImpl::setInterprocessSync(isc::util::InterprocessSync* sync) {
// If we are passed NULL, change nothing. The old sync_ object will // If we are passed NULL, change nothing. The old sync_ object will
// continue to be used. // continue to be used.
if (sync == NULL) if (sync == NULL) {
return; return;
}
delete sync_; delete sync_;
sync_ = sync; sync_ = sync;
......
...@@ -47,9 +47,9 @@ class InterprocessSync { ...@@ -47,9 +47,9 @@ class InterprocessSync {
public: public:
/// \brief Constructor /// \brief Constructor
/// ///
/// Creates a interprocess synchronization object /// Creates an interprocess synchronization object
/// ///
/// \param name Name of the synchronization task. This has to be /// \param task_name Name of the synchronization task. This has to be
/// identical among the various processes that need to be /// identical among the various processes that need to be
/// synchronized for the same task. /// synchronized for the same task.
InterprocessSync(const std::string& task_name) : InterprocessSync(const std::string& task_name) :
......
...@@ -20,8 +20,9 @@ using namespace std; ...@@ -20,8 +20,9 @@ using namespace std;
namespace isc { namespace isc {
namespace util { namespace util {
static unsigned char namespace {
parent_read_locked_state (int fd) { unsigned char
parentReadLockedState (int fd) {
unsigned char locked = 0xff; unsigned char locked = 0xff;
fd_set rfds; fd_set rfds;
...@@ -46,7 +47,7 @@ parent_read_locked_state (int fd) { ...@@ -46,7 +47,7 @@ parent_read_locked_state (int fd) {
read(fd, &locked, sizeof(locked)); read(fd, &locked, sizeof(locked));
} }
return locked; return (locked);
} }
TEST(InterprocessSyncFileTest, TestLock) { TEST(InterprocessSyncFileTest, TestLock) {
...@@ -85,7 +86,7 @@ TEST(InterprocessSyncFileTest, TestLock) { ...@@ -85,7 +86,7 @@ TEST(InterprocessSyncFileTest, TestLock) {
// Parent reads from pipe // Parent reads from pipe
close(fds[1]); close(fds[1]);
const unsigned char locked = parent_read_locked_state(fds[0]); const unsigned char locked = parentReadLockedState(fds[0]);
close(fds[0]); close(fds[0]);
...@@ -138,7 +139,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) { ...@@ -138,7 +139,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
// Parent reads from pipe // Parent reads from pipe
close(fds[1]); close(fds[1]);
const unsigned char locked = parent_read_locked_state(fds[0]); const unsigned char locked = parentReadLockedState(fds[0]);
close(fds[0]); close(fds[0]);
...@@ -147,6 +148,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) { ...@@ -147,6 +148,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
EXPECT_TRUE(locker.unlock()); EXPECT_TRUE(locker.unlock());
} }
}
} // namespace util } // namespace util
} // namespace isc } // namespace isc
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment