From f26bf1396557e4bc739d6a7703099f75bfe2fb99 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 25 Feb 2019 21:08:46 -0500 Subject: fix warning from -Wall --- src/nonstd/__pthread_per_thread.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nonstd/__pthread_per_thread.c') diff --git a/src/nonstd/__pthread_per_thread.c b/src/nonstd/__pthread_per_thread.c index 0dff3999..0f633a1b 100644 --- a/src/nonstd/__pthread_per_thread.c +++ b/src/nonstd/__pthread_per_thread.c @@ -1,10 +1,12 @@ +#if defined _POSIX_C_SOURCE && 199506L <= _POSIX_C_SOURCE + #include "pthread.h" static pthread_key_t __per_thread_key; static void __make_key(void) { - pthread_key_create(&key, NULL); + pthread_key_create(&__per_thread_key, NULL); } static struct per_thread *per_thread(void) @@ -12,12 +14,13 @@ static struct per_thread *per_thread(void) static pthread_once_t key_once = PTHREAD_ONCE_INIT; struct per_thread *pt; pthread_once(&key_once, __make_key); - if ((pt = pthread_getspecific(key)) == NULL) { + if ((pt = pthread_getspecific(__per_thread_key)) == NULL) { pt = calloc(1, sizeof (*pt)); - pthread_setspecific(key, pt); + pthread_setspecific(__per_thread_key, pt); } return pt; } +#endif /* LINK(pthread) -- cgit v1.2.1