Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1360579429.9132.37.camel@eris.loria.fr>
Date: Mon, 11 Feb 2013 11:44:21 +0100
From: Jens Gustedt <Jens.Gustedt@...ia.fr>
To: musl@...ts.openwall.com
Subject: [PATCH v3] move the definition of __pthread_tsd_main to the only
 compilation unit that references it

 - Avoids a const cast that doesn't seem to be very useful.
 - Remove unused __pthread_tsd_size

0	3	src/thread/pthread_key_create.c
2	4	src/thread/pthread_self.c

diff --git a/src/thread/pthread_key_create.c b/src/thread/pthread_key_create.c
index e51cb02..084cbaa 100644
--- a/src/thread/pthread_key_create.c
+++ b/src/thread/pthread_key_create.c
@@ -1,8 +1,5 @@
 #include "pthread_impl.h"
 
-const size_t __pthread_tsd_size = sizeof(void *) * PTHREAD_KEYS_MAX;
-void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
-
 static void (*keys[PTHREAD_KEYS_MAX])(void *);
 
 static void nodtor(void *dummy)
diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c
index 23dbaa5..af4998d 100644
--- a/src/thread/pthread_self.c
+++ b/src/thread/pthread_self.c
@@ -2,9 +2,7 @@
 
 static struct pthread *main_thread = &(struct pthread){0};
 
-/* pthread_key_create.c overrides this */
-static const void *dummy[1] = { 0 };
-weak_alias(dummy, __pthread_tsd_main);
+static void *__pthread_tsd_main[PTHREAD_KEYS_MAX];
 
 static int init_main_thread()
 {
@@ -12,7 +10,7 @@ static int init_main_thread()
 		SIGPT_SET, 0, __SYSCALL_SSLEN);
 	if (__set_thread_area(TP_ADJ(main_thread)) < 0) return -1;
 	main_thread->canceldisable = libc.canceldisable;
-	main_thread->tsd = (void **)__pthread_tsd_main;
+	main_thread->tsd = __pthread_tsd_main;
 	main_thread->errno_ptr = __errno_location();
 	main_thread->self = main_thread;
 	main_thread->tid = main_thread->pid =
-- 
1.7.9.5

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.