]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2202] small style fixes
authorJINMEI Tatuya <jinmei@isc.org>
Fri, 28 Sep 2012 22:10:32 +0000 (15:10 -0700)
committerJINMEI Tatuya <jinmei@isc.org>
Fri, 28 Sep 2012 22:10:32 +0000 (15:10 -0700)
- long/short lines
- position of ++/--
- spacing
- namespace

src/lib/util/threads/tests/lock_unittest.cc
src/lib/util/threads/tests/thread_unittest.cc
src/lib/util/threads/thread.cc

index 7ffc65416e34b57207b0843e36e1ac2f042410fe..f77aa579973d2e67ee7e5cc0a5cc3328ec6fcadc 100644 (file)
@@ -55,8 +55,8 @@ TEST(MutexTest, lockMultiple) {
 // tests fail then with rather cryptic messages, memory dumps and stuff).
 // Any idea how to make the test work and reasonably safe?
 TEST(MutexTest, DISABLED_destroyLocked) {
-    // TODO: This probably won't work for non-debug mutexes. Disable on non-debug
-    // compilation.
+    // TODO: This probably won't work for non-debug mutexes. Disable on
+    // non-debug compilation.
     Mutex* mutex = new Mutex;
     new Mutex::Locker(*mutex);
     EXPECT_THROW(delete mutex, isc::InvalidOperation);
@@ -86,11 +86,10 @@ const unsigned long long length = 1000;
 const unsigned long long iterations = 10000;
 const unsigned long long value = 2000;
 void
-performStrangeOperation(long long unsigned* array, int direction,
-                        Mutex* mutex)
+performStrangeOperation(long long unsigned* array, int direction, Mutex* mutex)
 {
     unsigned long long position = 0;
-    for (size_t i = 0; i < iterations; i ++) {
+    for (size_t i = 0; i < iterations; ++i) {
         Mutex::Locker lock(*mutex);
         while (array[position % length] < value) {
             position += direction;
@@ -102,8 +101,8 @@ performStrangeOperation(long long unsigned* array, int direction,
             if (p2 % length == position % length) {
                 continue;
             }
-            array[p2 % length] ++;
-            value --;
+            ++array[p2 % length];
+            --value;
         }
         array[position % length] = 0;
     }
@@ -113,7 +112,7 @@ TEST(MutexTest, swarm) {
     // This type has a low chance of being atomic itself, further raising
     // the chance of problems appearing.
     long long unsigned array[length];
-    for (size_t i = 0; i < length; ++ i) {
+    for (size_t i = 0; i < length; ++i) {
         array[i] = value;
     }
     Mutex mutex;
@@ -122,7 +121,7 @@ TEST(MutexTest, swarm) {
     t1.wait();
     t2.wait();
     long long unsigned sum = 0;
-    for (size_t i = 0; i < length; ++ i) {
+    for (size_t i = 0; i < length; ++i) {
         sum += array[i];
     }
     EXPECT_EQ(length * value, sum) << "Threads are badly synchronized";
index f94c3595cf1f2d289cc362d2070d1c22b71d0687..fd66591fd4466c7469a4d5c71037116e7df07b71 100644 (file)
 // started in parallel (the other tests wait for the previous one to terminate
 // before starting new one).
 
-const size_t iterations = 200;
-const size_t detached_iterations = 25;
-
 using namespace isc::util::thread;
 
 namespace {
+const size_t iterations = 200;
+const size_t detached_iterations = 25;
 
 void
 doSomething(int* x) {
index bbf7f513e25db7317762677011d6b386551e1e06..8b2c7ad89cb74d2024da6861e5ef28bdf963c0ed 100644 (file)
@@ -113,8 +113,7 @@ Thread::~Thread() {
         const int result = pthread_detach(impl_->tid);
         Impl::done(impl_);
         impl_ = NULL;
-        // If the detach ever fails, something is screwed rather
-        // badly.
+        // If the detach ever fails, something is screwed rather badly.
         assert(result == 0);
     }
 }