Switch to g_ for globals.
That's what the Google style guide recommends, and we're starting
to get a mix.
Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index b31d7e4..3b3c0f6 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -27,9 +27,9 @@
#define ASSERT_SUBSTR(needle, haystack) \
ASSERT_PRED_FORMAT2(::testing::IsSubstring, needle, haystack)
-static bool gCalled = false;
+static bool g_called = false;
extern "C" void DlSymTestFunction() {
- gCalled = true;
+ g_called = true;
}
TEST(dlfcn, dlsym_in_self) {
@@ -43,9 +43,9 @@
void (*function)() = reinterpret_cast<void(*)()>(sym);
- gCalled = false;
+ g_called = false;
function();
- ASSERT_TRUE(gCalled);
+ ASSERT_TRUE(g_called);
ASSERT_EQ(0, dlclose(self));
}
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 6a5e4a6..b9a0c2c 100644
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -560,27 +560,27 @@
ASSERT_EQ(0, pthread_rwlock_destroy(&l));
}
-static int gOnceFnCallCount = 0;
+static int g_once_fn_call_count = 0;
static void OnceFn() {
- ++gOnceFnCallCount;
+ ++g_once_fn_call_count;
}
TEST(pthread, pthread_once_smoke) {
pthread_once_t once_control = PTHREAD_ONCE_INIT;
ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
ASSERT_EQ(0, pthread_once(&once_control, OnceFn));
- ASSERT_EQ(1, gOnceFnCallCount);
+ ASSERT_EQ(1, g_once_fn_call_count);
}
-static int gAtForkPrepareCalls = 0;
-static void AtForkPrepare1() { gAtForkPrepareCalls = (gAtForkPrepareCalls << 4) | 1; }
-static void AtForkPrepare2() { gAtForkPrepareCalls = (gAtForkPrepareCalls << 4) | 2; }
-static int gAtForkParentCalls = 0;
-static void AtForkParent1() { gAtForkParentCalls = (gAtForkParentCalls << 4) | 1; }
-static void AtForkParent2() { gAtForkParentCalls = (gAtForkParentCalls << 4) | 2; }
-static int gAtForkChildCalls = 0;
-static void AtForkChild1() { gAtForkChildCalls = (gAtForkChildCalls << 4) | 1; }
-static void AtForkChild2() { gAtForkChildCalls = (gAtForkChildCalls << 4) | 2; }
+static int g_atfork_prepare_calls = 0;
+static void AtForkPrepare1() { g_atfork_prepare_calls = (g_atfork_prepare_calls << 4) | 1; }
+static void AtForkPrepare2() { g_atfork_prepare_calls = (g_atfork_prepare_calls << 4) | 2; }
+static int g_atfork_parent_calls = 0;
+static void AtForkParent1() { g_atfork_parent_calls = (g_atfork_parent_calls << 4) | 1; }
+static void AtForkParent2() { g_atfork_parent_calls = (g_atfork_parent_calls << 4) | 2; }
+static int g_atfork_child_calls = 0;
+static void AtForkChild1() { g_atfork_child_calls = (g_atfork_child_calls << 4) | 1; }
+static void AtForkChild2() { g_atfork_child_calls = (g_atfork_child_calls << 4) | 2; }
TEST(pthread, pthread_atfork) {
ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1));
@@ -591,13 +591,13 @@
// Child and parent calls are made in the order they were registered.
if (pid == 0) {
- ASSERT_EQ(0x12, gAtForkChildCalls);
+ ASSERT_EQ(0x12, g_atfork_child_calls);
_exit(0);
}
- ASSERT_EQ(0x12, gAtForkParentCalls);
+ ASSERT_EQ(0x12, g_atfork_parent_calls);
// Prepare calls are made in the reverse order.
- ASSERT_EQ(0x21, gAtForkPrepareCalls);
+ ASSERT_EQ(0x21, g_atfork_prepare_calls);
}
TEST(pthread, pthread_attr_getscope) {
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index af98964..89b8088 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -146,10 +146,10 @@
ASSERT_EQ(SIGALRM, received_signal);
}
-static int gSigSuspendTestHelperCallCount = 0;
+static int g_sigsuspend_test_helper_call_count = 0;
static void SigSuspendTestHelper(int) {
- ++gSigSuspendTestHelperCallCount;
+ ++g_sigsuspend_test_helper_call_count;
}
TEST(signal, sigsuspend_sigpending) {
@@ -172,7 +172,7 @@
// Raise SIGALRM and check our signal handler wasn't called.
raise(SIGALRM);
- ASSERT_EQ(0, gSigSuspendTestHelperCallCount);
+ ASSERT_EQ(0, g_sigsuspend_test_helper_call_count);
// We should now have a pending SIGALRM but nothing else.
sigemptyset(&pending);
@@ -188,7 +188,7 @@
ASSERT_EQ(-1, sigsuspend(¬_SIGALRM));
ASSERT_EQ(EINTR, errno);
// ...and check that we now receive our pending SIGALRM.
- ASSERT_EQ(1, gSigSuspendTestHelperCallCount);
+ ASSERT_EQ(1, g_sigsuspend_test_helper_call_count);
// Restore the original set.
ASSERT_EQ(0, sigprocmask(SIG_SETMASK, &original_set, NULL));
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index ff05039..3f31861 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -114,18 +114,18 @@
ASSERT_EQ(123, sb.st_size);
}
-static bool gPauseTestFlag = false;
+static bool g_pause_test_flag = false;
static void PauseTestSignalHandler(int) {
- gPauseTestFlag = true;
+ g_pause_test_flag = true;
}
TEST(unistd, pause) {
ScopedSignalHandler handler(SIGALRM, PauseTestSignalHandler);
alarm(1);
- ASSERT_FALSE(gPauseTestFlag);
+ ASSERT_FALSE(g_pause_test_flag);
ASSERT_EQ(-1, pause());
- ASSERT_TRUE(gPauseTestFlag);
+ ASSERT_TRUE(g_pause_test_flag);
}
TEST(unistd, read) {