Browse Source

[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.
JINMEI Tatuya 13 years ago
parent
commit
075eef9a1f

+ 2 - 1
src/lib/log/logger_impl.cc

@@ -113,8 +113,9 @@ void
 LoggerImpl::setInterprocessSync(isc::util::InterprocessSync* sync) {
     // If we are passed NULL, change nothing. The old sync_ object will
     // continue to be used.
-    if (sync == NULL)
+    if (sync == NULL) {
         return;
+    }
 
     delete sync_;
     sync_ = sync;

+ 2 - 2
src/lib/util/interprocess_sync.h

@@ -47,9 +47,9 @@ class InterprocessSync {
 public:
     /// \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
     /// synchronized for the same task.
     InterprocessSync(const std::string& task_name) :

+ 7 - 5
src/lib/util/tests/interprocess_sync_file_unittest.cc

@@ -20,8 +20,9 @@ using namespace std;
 namespace isc {
 namespace util {
 
-static unsigned char
-parent_read_locked_state (int fd) {
+namespace {
+unsigned char
+parentReadLockedState (int fd) {
   unsigned char locked = 0xff;
 
   fd_set rfds;
@@ -46,7 +47,7 @@ parent_read_locked_state (int fd) {
       read(fd, &locked, sizeof(locked));
   }
 
-  return locked;
+  return (locked);
 }
 
 TEST(InterprocessSyncFileTest, TestLock) {
@@ -85,7 +86,7 @@ TEST(InterprocessSyncFileTest, TestLock) {
       // Parent reads from pipe
       close(fds[1]);
 
-      const unsigned char locked = parent_read_locked_state(fds[0]);
+      const unsigned char locked = parentReadLockedState(fds[0]);
 
       close(fds[0]);
 
@@ -138,7 +139,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
       // Parent reads from pipe
       close(fds[1]);
 
-      const unsigned char locked = parent_read_locked_state(fds[0]);
+      const unsigned char locked = parentReadLockedState(fds[0]);
 
       close(fds[0]);
 
@@ -147,6 +148,7 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) {
 
   EXPECT_TRUE(locker.unlock());
 }
+}
 
 } // namespace util
 } // namespace isc