diff options
author | Elliott Hughes <enh@google.com> | 2015-03-31 10:56:58 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-03-31 10:56:58 -0700 |
commit | 6170693e28dd72a1517c267f3f62b3f37477b8bb (patch) | |
tree | f7cf73e397d83074a6da0b6cce4459b51af334cf /libc/bionic/strerror.cpp | |
parent | 611fd2cc91f79be6759f6e630e1e81998326dfe8 (diff) | |
download | android_bionic-6170693e28dd72a1517c267f3f62b3f37477b8bb.tar.gz android_bionic-6170693e28dd72a1517c267f3f62b3f37477b8bb.tar.bz2 android_bionic-6170693e28dd72a1517c267f3f62b3f37477b8bb.zip |
Make ThreadLocalBuffer a class rather than a macro.
Bug: 19995392
Change-Id: I497c512648fbe66257da3fb3bcd5c9911f983705
Diffstat (limited to 'libc/bionic/strerror.cpp')
-rw-r--r-- | libc/bionic/strerror.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libc/bionic/strerror.cpp b/libc/bionic/strerror.cpp index d1518ffc4..f74194fd9 100644 --- a/libc/bionic/strerror.cpp +++ b/libc/bionic/strerror.cpp @@ -31,16 +31,16 @@ extern "C" const char* __strerror_lookup(int); -GLOBAL_INIT_THREAD_LOCAL_BUFFER(strerror); +static ThreadLocalBuffer<char, NL_TEXTMAX> g_strerror_tls_buffer; char* strerror(int error_number) { // Just return the original constant in the easy cases. char* result = const_cast<char*>(__strerror_lookup(error_number)); - if (result != NULL) { + if (result != nullptr) { return result; } - LOCAL_INIT_THREAD_LOCAL_BUFFER(char*, strerror, NL_TEXTMAX); - strerror_r(error_number, strerror_tls_buffer, strerror_tls_buffer_size); - return strerror_tls_buffer; + result = g_strerror_tls_buffer.get(); + strerror_r(error_number, result, g_strerror_tls_buffer.size()); + return result; } |