]> code.delx.au - pulseaudio/blobdiff - src/daemon/ltdl-bind-now.c
add i18n support
[pulseaudio] / src / daemon / ltdl-bind-now.c
index 6915fe0cfa88dde05be3fad3343b7d22769a8042..400772488f943f4528782f2aaceeca6a54787204 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
 #include <sys/dl.h>
 #endif
 
-#ifndef HAVE_STRUCT_LT_USER_DLLOADER
-/* Only used with ltdl 2.2 */
 #include <string.h>
-#endif
 
 #include <ltdl.h>
 
+#include <pulse/i18n.h>
+
 #include <pulsecore/macro.h>
 #include <pulsecore/mutex.h>
 #include <pulsecore/thread.h>
@@ -56,6 +53,8 @@
 #undef PA_BIND_NOW
 #endif
 
+#ifdef HAVE_LT_DLMUTEX_REGISTER
+
 static pa_mutex *libtool_mutex = NULL;
 
 PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls);
@@ -76,6 +75,8 @@ static const char *libtool_get_error(void) {
     return PA_STATIC_TLS_GET(libtool_tls);
 }
 
+#endif
+
 #ifdef PA_BIND_NOW
 
 /*
@@ -91,10 +92,11 @@ static const char *libtool_get_error(void) {
 */
 
 #ifndef HAVE_LT_DLADVISE
-static lt_module bind_now_open(lt_user_data d, const char *fname) {
+static lt_module bind_now_open(lt_user_data d, const char *fname)
 #else
-  static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) {
+static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise)
 #endif
+{
     lt_module m;
 
     pa_assert(fname);
@@ -152,8 +154,9 @@ void pa_ltdl_init(void) {
 #endif
 
     pa_assert_se(lt_dlinit() == 0);
-    pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE));
+
 #ifdef HAVE_LT_DLMUTEX_REGISTER
+    pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE));
     pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0);
 #endif
 
@@ -165,14 +168,15 @@ void pa_ltdl_init(void) {
 
     /* Add our BIND_NOW loader as the default module loader. */
     if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0)
-        pa_log_warn("Failed to add bind-now-loader.");
+        pa_log_warn(_("Failed to add bind-now-loader."));
 # else
     /* Already initialised */
-    if ( dlopen_loader != NULL ) return;
+    if (dlopen_loader)
+        return;
 
     if (!(dlopen_loader = lt_dlloader_find("dlopen"))) {
-      pa_log_warn("Failed to find original dlopen loader.");
-      return;
+        pa_log_warn(_("Failed to find original dlopen loader."));
+        return;
     }
 
     memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader));
@@ -184,14 +188,16 @@ void pa_ltdl_init(void) {
 
     /* Add our BIND_NOW loader as the default module loader. */
     if (lt_dlloader_add(&bindnow_loader) != 0)
-        pa_log_warn("Failed to add bind-now-loader.");
+        pa_log_warn(_("Failed to add bind-now-loader."));
 # endif
 #endif
 }
 
 void pa_ltdl_done(void) {
     pa_assert_se(lt_dlexit() == 0);
+
+#ifdef HAVE_LT_DLMUTEX_REGISTER
     pa_mutex_free(libtool_mutex);
     libtool_mutex = NULL;
+#endif
 }
-