Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3422)

Unified Diff: base/shared_memory_unittest.cc

Issue 8273009: Don't use `sizeof(a) / sizeof(a)` to compute the number of elements in array a. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wtc Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_unittest.cc
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index 9472101cb741b59e9cda3d2bc0bb21f2f608eeca..330add4850779b28b6ec0b805c2bef6e2d2af309 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -42,13 +42,15 @@ class MultipleThreadMain : public PlatformThread::Delegate {
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 @@ TEST(SharedMemoryTest, MultipleThreads) {
// 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698