From c25520ae92f034a05912c8c14248c8fb3c174f1c Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 25 Jan 2012 19:01:02 +0400 Subject: [PATCH] Code refactoring of GC_init_real_syms (GC_USE_DLOPEN_WRAP case) * pthread_support.c (GC_init_real_syms): Remove LIBPTHREAD_NAME, LIBPTHREAD_NAME_LEN, len, namebuf, libpthread_name and simplify the code invoking dlopen (if RTLD_NEXT not defined). --- pthread_support.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/pthread_support.c b/pthread_support.c index 41549cf1..218b662e 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -227,25 +227,14 @@ GC_INNER unsigned long GC_lock_holder = NO_THREAD; STATIC void GC_init_real_syms(void) { void *dl_handle; -# ifndef RTLD_NEXT -# define LIBPTHREAD_NAME "libpthread.so.0" -# define LIBPTHREAD_NAME_LEN 16 /* incl. trailing 0 */ - size_t len = LIBPTHREAD_NAME_LEN - 1; - char namebuf[LIBPTHREAD_NAME_LEN]; - static char *libpthread_name = LIBPTHREAD_NAME; -# endif if (GC_syms_initialized) return; # ifdef RTLD_NEXT dl_handle = RTLD_NEXT; # else - dl_handle = dlopen(libpthread_name, RTLD_LAZY); + dl_handle = dlopen("libpthread.so.0", RTLD_LAZY); if (NULL == dl_handle) { - while (isdigit(libpthread_name[len-1])) --len; - if (libpthread_name[len-1] == '.') --len; - BCOPY(libpthread_name, namebuf, len); - namebuf[len] = '\0'; - dl_handle = dlopen(namebuf, RTLD_LAZY); + dl_handle = dlopen("libpthread.so", RTLD_LAZY); /* without ".0" */ } if (NULL == dl_handle) ABORT("Couldn't open libpthread"); # endif -- 2.40.0