summaryrefslogtreecommitdiff
path: root/tests/string_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-10-16 15:54:46 -0700
committerElliott Hughes <enh@google.com>2012-10-16 17:58:17 -0700
commit5419b9474753d25dff947c7740532f86d130c0be (patch)
tree4d746cfc20a1d3b5886f691ed1a49ddf34e2df78 /tests/string_test.cpp
parenta9944cfe9e152ca46afb0a77300ec5a2a1a24e64 (diff)
Make dlerror(3) thread-safe.
I gave up trying to use the usual thread-local buffer idiom; calls to calloc(3) and free(3) from any of the "dl" functions -- which live in the dynamic linker -- end up resolving to the dynamic linker's stubs. I tried to work around that, but was just making things more complicated. This alternative costs us a well-known TLS slot (instead of the dynamically-allocated TLS slot we'd have used otherwise, so no difference there), plus an extra buffer inside every pthread_internal_t. Bug: 5404023 Change-Id: Ie9614edd05b6d1eeaf7bf9172792d616c6361767
Diffstat (limited to 'tests/string_test.cpp')
-rw-r--r--tests/string_test.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
index ea1491c77..47469d853 100644
--- a/tests/string_test.cpp
+++ b/tests/string_test.cpp
@@ -29,7 +29,7 @@ TEST(string, strerror) {
ASSERT_STREQ("Unknown error 1234", strerror(1234));
}
-void* ConcurrentStrErrorFn(void* arg) {
+static void* ConcurrentStrErrorFn(void* arg) {
bool equal = (strcmp("Unknown error 2002", strerror(2002)) == 0);
return reinterpret_cast<void*>(equal);
}
@@ -88,7 +88,7 @@ TEST(string, strsignal) {
ASSERT_STREQ("Unknown signal 1234", strsignal(1234)); // Too large.
}
-void* ConcurrentStrSignalFn(void* arg) {
+static void* ConcurrentStrSignalFn(void* arg) {
bool equal = (strcmp("Unknown signal 2002", strsignal(2002)) == 0);
return reinterpret_cast<void*>(equal);
}