]> granicus.if.org Git - gc/commitdiff
Code refactoring of GC_init_real_syms (GC_USE_DLOPEN_WRAP case)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 25 Jan 2012 15:01:02 +0000 (19:01 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 25 Jan 2012 15:01:02 +0000 (19:01 +0400)
* 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

index 41549cf11426a48b85617987f9792653d9b5cd85..218b662efc1c2577555e8676b3e0402e5932ee45 100644 (file)
@@ -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