Don't use `sizeof(a) / sizeof(a)` to compute the number of elements in array a.

The interesting parts of the patch are by wtc.

Found by PVS Studio: http://www.viva64.com/en/b/0113/ , N12

BUG=100278
TEST=none


Review URL: http://codereview.chromium.org/8273009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105467 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: e62b55134fab8df52edd47cb370f768f050f6eaf
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index 9472101..330add4 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -42,13 +42,15 @@
     rv = memory.Map(kDataSize);
     EXPECT_TRUE(rv);
     int *ptr = static_cast<int*>(memory.memory()) + id_;
-    EXPECT_EQ(*ptr, 0);
+    EXPECT_EQ(0, *ptr);
 
     for (int idx = 0; idx < 100; idx++) {
       *ptr = idx;
       PlatformThread::Sleep(1);  // Short wait.
       EXPECT_EQ(*ptr, idx);
     }
+    // Reset back to 0 for the next test that uses the same name.
+    *ptr = 0;
 
     memory.Close();
   }
@@ -228,7 +230,7 @@
   // kNumThreads.
 
   int threadcounts[] = { 1, kNumThreads };
-  for (size_t i = 0; i < sizeof(threadcounts) / sizeof(threadcounts); i++) {
+  for (size_t i = 0; i < arraysize(threadcounts); i++) {
     int numthreads = threadcounts[i];
     scoped_array<PlatformThreadHandle> thread_handles;
     scoped_array<MultipleThreadMain*> thread_delegates;