]> git.sesse.net Git - vlc/commitdiff
Small code factorization
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 10 Jan 2009 12:51:51 +0000 (14:51 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 10 Jan 2009 12:51:51 +0000 (14:51 +0200)
src/modules/os.c

index 38df5e77159e8407c41125306ed338498d863f22..997e780b523a0db418688400817d51087a3386af 100644 (file)
@@ -213,27 +213,21 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
         return -1;
     }
 
-#elif defined(HAVE_DL_DLOPEN) && defined(RTLD_NOW)
+#elif defined(HAVE_DL_DLOPEN)
 # if defined (RTLD_NOLOAD)
     static pthread_once_t once = PTHREAD_ONCE_INIT;
     pthread_once( &once, &load_libvlccore );
 # endif
 
-    /* static is OK, we are called atomically */
-    handle = dlopen( psz_file, RTLD_NOW );
-    if( handle == NULL )
-    {
-        msg_Warn( p_this, "cannot load module `%s' (%s)",
-                          psz_file, dlerror() );
-        return -1;
-    }
+# if defined (RTLD_NOW)
+    const int flags = RTLD_NOW;
+# elif defined (DL_LAZY)
+    const int flags = DL_LAZY;
+# else
+    const int flags = 0;
+# endif
 
-#elif defined(HAVE_DL_DLOPEN)
-#   if defined(DL_LAZY)
-    handle = dlopen( psz_file, DL_LAZY );
-#   else
-    handle = dlopen( psz_file, 0 );
-#   endif
+    handle = dlopen( psz_file, RTLD_NOW );
     if( handle == NULL )
     {
         msg_Warn( p_this, "cannot load module `%s' (%s)",