libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool--gary--1.0--patch-6


From: Gary V. Vaughan
Subject: Re: libtool--gary--1.0--patch-6
Date: Thu, 08 Apr 2004 10:34:48 +0100
User-agent: Mozilla Thunderbird 0.5 (X11/20040208)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bob Friesenhahn wrote:
| On Wed, 7 Apr 2004, Gary V. Vaughan wrote:
|>you can browse these patches on the web at:
|>
|>http://tkd.kicks-ass.net/arch/address@hidden/libtool--gary--1.0--patch-6
|>
|>Okay to commit?
|
| No.  Since the patch contains no lines, my opinion is no.

Doh! Incase my machine is offline, I've pasted the contents of the url above
into the attached :-b

On the bright side, I have the patch request part of my scripts working now,
so this shouldn't happen again... now to iron out the merge and flush to cvs
scripts ;-)

Cheers,
        Gary.
- --
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAdRy4FRMICSmD1gYRAmZdAJ9b/a6ak+p7gbE8tBwVEDyqftOS2wCbBNhW
n86wEJmH31vtmtPdzxIUrz8=
=JQo6
-----END PGP SIGNATURE-----
Index: ChangeLog
from Gary V. Vaughan  <address@hidden>

        Factor out the mutex handling and error handling into their own
        modules.  Mutex handling is not currently useful in combination
        with posix threads, and should be easier to replace if it is in a
        separate module.  Additionally, we can factor out the loaders in
        such a way as to depend on only the portability layer and these
        new mutex and error modules now:

        * libltdl/Makefile.am (pkginclude_HEADERS): Install lt_error.h and
        lt_mutex.h to $includedir/libltdl.
        (libltdl_la_SOURCES): Build lt_error and lt_mutex objects.
        * libltdl/ltdl.h (LT_SCOPE): Moved from here...
        * libltdl/lt_system.h (LT_SCOPE): ...to here.
        * libltdl/ltdl.c (lt_dlerror_strings, LT_DLSTRERROR): Moved from
        here...
        * libltdl/lt__private.h (lt__error_strings, LT__STRERROR): ...to
        here as additional internal interfaces to lt_error.  Changed all
        callers.
        * libltdl/ltdl.c (LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK)
        (LT_DLMUTEX_SETERROR, LT_DLMUTEX_GETERROR, lt_dlmutex_lock_func)
        (lt_dlmutex_unlock_func, lt_dlmutex_geterror_func)
        (lt_dllast_error): Moved from here...
        (LT__MUTEX_LOCK, LT__MUTEX_UNLOCK, LT__MUTEX_SETERRORSTR)
        (LT__MUTEX_GETERROR, lt__mutex_lock_func, lt__mutex_unlock_func)
        (lt__mutex_geterror_func, lt__last_error): ...to here as
        additional internal interfaces to lt_mutex.  Changed all callers.
        (LT_MUTEX_SETERROR): Take an errorcode rather than a string.
        Changed all callers.
        * libltdl/ltdl.c, libltdl/ltdl.h (lt_dlmutex_register): Moved from
        here...
        * libltdl/lt_mutex.c, libltdl/lt_mutex.h (lt_dlmutex_register):
        ...to here. New files.
        * libltdl/ltdl.c, libltdl/ltdl.h (lt_dladderror, lt_dlseterror)
        (lt_dlerror_table):
        Moved from here...
        * libltdl/lt_error.c, libltdl/lt_error.h (lt_dladderror)
        (lt_dlseterror, lt_dlerror_table): ...to here. New files.

--- orig/libltdl/.arch-ids/lt_error.c.id
+++ mod/libltdl/.arch-ids/lt_error.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Wed Apr  7 11:38:20 2004 26004.0
--- orig/libltdl/.arch-ids/lt_error.h.id
+++ mod/libltdl/.arch-ids/lt_error.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Wed Apr  7 11:38:20 2004 26004.1
--- orig/libltdl/.arch-ids/lt_mutex.c.id
+++ mod/libltdl/.arch-ids/lt_mutex.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Wed Apr  7 11:38:20 2004 26004.2
--- orig/libltdl/.arch-ids/lt_mutex.h.id
+++ mod/libltdl/.arch-ids/lt_mutex.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Wed Apr  7 11:38:20 2004 26004.3
--- 
orig/{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-6
+++ 
mod/{arch}/libtool/libtool--gary/libtool--gary--1.0/address@hidden/patch-log/patch-6
@@ -0,1 +1,55 @@
+Revision: libtool--gary--1.0--patch-6
+Archive: address@hidden
+Creator: Gary V. Vaughan <address@hidden>
+Date: Wed Apr  7 17:07:38 BST 2004
+Standard-date: 2004-04-07 16:07:38 GMT
+New-files: libltdl/.arch-ids/lt_error.c.id
+    libltdl/.arch-ids/lt_error.h.id
+    libltdl/.arch-ids/lt_mutex.c.id
+    libltdl/.arch-ids/lt_mutex.h.id libltdl/lt_error.c
+    libltdl/lt_error.h libltdl/lt_mutex.c libltdl/lt_mutex.h
+Modified-files: ChangeLog config/config.guess
+    config/config.sub libltdl/Makefile.am
+    libltdl/lt__private.h libltdl/lt_system.h libltdl/ltdl.c
+    libltdl/ltdl.h
+New-patches: address@hidden/libtool--gary--1.0--patch-6
+Summary: factor out mutex and error modules
+Keywords:
+
+Factor out the mutex handling and error handling into their own
+modules.  Mutex handling is not currently useful in combination
+with posix threads, and should be easier to replace if it is in a
+separate module.  Additionally, we can factor out the loaders in
+such a way as to depend on only the portability layer and these
+new mutex and error modules now:
+
+* libltdl/Makefile.am (pkginclude_HEADERS): Install lt_error.h and
+lt_mutex.h to $includedir/libltdl.
+(libltdl_la_SOURCES): Build lt_error and lt_mutex objects.
+* libltdl/ltdl.h (LT_SCOPE): Moved from here...
+* libltdl/lt_system.h (LT_SCOPE): ...to here.
+* libltdl/ltdl.c (lt_dlerror_strings, LT_DLSTRERROR): Moved from
+here...
+* libltdl/lt__private.h (lt__error_strings, LT__STRERROR): ...to
+here as additional internal interfaces to lt_error.  Changed all
+callers.
+* libltdl/ltdl.c (LT_DLMUTEX_LOCK, LT_DLMUTEX_UNLOCK)
+(LT_DLMUTEX_SETERROR, LT_DLMUTEX_GETERROR, lt_dlmutex_lock_func)
+(lt_dlmutex_unlock_func, lt_dlmutex_geterror_func)
+(lt_dllast_error): Moved from here...
+(LT__MUTEX_LOCK, LT__MUTEX_UNLOCK, LT__MUTEX_SETERRORSTR)
+(LT__MUTEX_GETERROR, lt__mutex_lock_func, lt__mutex_unlock_func)
+(lt__mutex_geterror_func, lt__last_error): ...to here as
+additional internal interfaces to lt_mutex.  Changed all callers.
+(LT_MUTEX_SETERROR): Take an errorcode rather than a string.
+Changed all callers.
+* libltdl/ltdl.c, libltdl/ltdl.h (lt_dlmutex_register): Moved from
+here...
+* libltdl/lt_mutex.c, libltdl/lt_mutex.h (lt_dlmutex_register):
+...to here. New files.
+* libltdl/ltdl.c, libltdl/ltdl.h (lt_dladderror, lt_dlseterror)
+(lt_dlerror_table):
+Moved from here...
+* libltdl/lt_error.c, libltdl/lt_error.h (lt_dladderror)
+(lt_dlseterror, lt_dlerror_table): ...to here. New files.
--- orig/libltdl/lt_error.c
+++ mod/libltdl/lt_error.c
@@ -0,0 +1,88 @@
+/* lt_error.c -- error propogation interface
+   Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <address@hidden>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307  USA
+*/
+
+#include "lt_error.h"
+#include "lt_mutex.h"
+#include "lt__private.h"
+
+static const char    **user_error_strings      = 0;
+static int             errorcount              = LT_ERROR_MAX;
+
+int
+lt_dladderror (const char *diagnostic)
+{
+  int          errindex = 0;
+  int          result   = -1;
+  const char  **temp     = (const char **) 0;
+
+  assert (diagnostic);
+
+  LT__MUTEX_LOCK ();
+
+  errindex = errorcount - LT_ERROR_MAX;
+  temp = REALLOC (const char *, user_error_strings, 1 + errindex);
+  if (temp)
+    {
+      user_error_strings               = temp;
+      user_error_strings[errindex]     = diagnostic;
+      result                           = errorcount++;
+    }
+
+  LT__MUTEX_UNLOCK ();
+
+  return result;
+}
+
+int
+lt_dlseterror (int errindex)
+{
+  int          errors   = 0;
+
+  LT__MUTEX_LOCK ();
+
+  if (errindex >= errorcount || errindex < 0)
+    {
+      /* Ack!  Error setting the error message! */
+      LT__MUTEX_SETERROR (INVALID_ERRORCODE);
+      ++errors;
+    }
+  else if (errindex < LT_ERROR_MAX)
+    {
+      /* No error setting the error message! */
+      LT__MUTEX_SETERRORSTR (lt__error_strings[errindex]);
+    }
+  else
+    {
+      /* No error setting the error message! */
+      LT__MUTEX_SETERRORSTR (user_error_strings[errindex - LT_ERROR_MAX]);
+    }
+
+  LT__MUTEX_UNLOCK ();
+
+  return errors;
+}
--- orig/libltdl/lt_error.h
+++ mod/libltdl/lt_error.h
@@ -0,0 +1,78 @@
+/* lt_error.h -- error propogation interface
+   Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <address@hidden>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307  USA
+*/
+
+/* Only include this header file once. */
+#ifndef LT_ERROR_H
+#define LT_ERROR_H 1
+
+#include <libltdl/lt_system.h>
+
+LT_BEGIN_C_DECLS
+
+/* Defining error strings alongside their symbolic names in a macro in
+   this way allows us to expand the macro in different contexts with
+   confidence that the enumeration of symbolic names will map correctly
+   onto the table of error strings.  */
+#define lt_dlerror_table                                               \
+    LT_ERROR(UNKNOWN,              "unknown error")                    \
+    LT_ERROR(DLOPEN_NOT_SUPPORTED,  "dlopen support not available")    \
+    LT_ERROR(INVALID_LOADER,       "invalid loader")                   \
+    LT_ERROR(INIT_LOADER,          "loader initialization failed")     \
+    LT_ERROR(REMOVE_LOADER,        "loader removal failed")            \
+    LT_ERROR(FILE_NOT_FOUND,       "file not found")                   \
+    LT_ERROR(DEPLIB_NOT_FOUND,      "dependency library not found")    \
+    LT_ERROR(NO_SYMBOLS,           "no symbols defined")               \
+    LT_ERROR(CANNOT_OPEN,          "can't open the module")            \
+    LT_ERROR(CANNOT_CLOSE,         "can't close the module")           \
+    LT_ERROR(SYMBOL_NOT_FOUND,      "symbol not found")                        
\
+    LT_ERROR(NO_MEMORY,                    "not enough memory")                
\
+    LT_ERROR(INVALID_HANDLE,       "invalid module handle")            \
+    LT_ERROR(BUFFER_OVERFLOW,      "internal buffer overflow")         \
+    LT_ERROR(INVALID_ERRORCODE,     "invalid errorcode")               \
+    LT_ERROR(SHUTDOWN,             "library already shutdown")         \
+    LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module")     \
+    LT_ERROR(INVALID_MUTEX_ARGS,    "invalid mutex handler registration") \
+    LT_ERROR(INVALID_POSITION,     "invalid search path insert position")
+
+/* Enumerate the symbolic error names. */
+enum {
+#define LT_ERROR(name, diagnostic)     LT_CONC(LT_ERROR_, name),
+       lt_dlerror_table
+#undef LT_ERROR
+
+       LT_ERROR_MAX
+};
+
+/* These functions are only useful from inside custom module loaders. */
+LT_SCOPE int   lt_dladderror   (const char *diagnostic);
+LT_SCOPE int   lt_dlseterror   (int errorcode);
+
+
+LT_END_C_DECLS
+
+#endif /*!LT_ERROR_H*/
--- orig/libltdl/lt_mutex.c
+++ mod/libltdl/lt_mutex.c
@@ -0,0 +1,78 @@
+/* lt_mutex.c -- mutex locking implementation
+   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+   Originally by Gary V. Vaughan  <address@hidden>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307  USA
+
+*/
+
+#include "lt_mutex.h"
+#include "lt_error.h"
+#include "lt__private.h"
+
+/* The mutex functions stored here are global, and are necessarily the
+   same for all threads that wish to share access to libltdl.  */
+lt_dlmutex_lock            *lt__mutex_lock_func     = 0;
+lt_dlmutex_unlock   *lt__mutex_unlock_func   = 0;
+lt_dlmutex_seterror *lt__mutex_seterror_func = 0;
+lt_dlmutex_geterror *lt__mutex_geterror_func = 0;
+const char         *lt__last_error           = 0;
+
+
+/* Either set or reset the mutex functions.  Either all the arguments must
+   be valid functions, or else all can be NULL to turn off locking entirely.
+   The registered functions should be manipulating a static global lock
+   from the lock() and unlock() callbacks, which needs to be reentrant.  */
+int
+lt_dlmutex_register (lt_dlmutex_lock *lock, lt_dlmutex_unlock *unlock,
+    lt_dlmutex_seterror *seterror, lt_dlmutex_geterror *geterror)
+{
+  lt_dlmutex_unlock *old_unlock = unlock;
+  int               errors     = 0;
+
+  /* Lock using the old lock() callback, if any.  */
+  LT__MUTEX_LOCK ();
+
+  if ((lock && unlock && seterror && geterror)
+      || !(lock || unlock || seterror || geterror))
+    {
+      lt__mutex_lock_func     = lock;
+      lt__mutex_unlock_func   = unlock;
+      lt__mutex_geterror_func = geterror;
+    }
+  else
+    {
+      LT__MUTEX_SETERROR (INVALID_MUTEX_ARGS);
+      ++errors;
+    }
+
+  /* Use the old unlock() callback we saved earlier, if any.  Otherwise
+     record any errors using internal storage.  */
+  if (old_unlock)
+    (*old_unlock) ();
+
+  /* Return the number of errors encountered during the execution of
+     this function.  */
+  return errors;
+}
--- orig/libltdl/lt_mutex.h
+++ mod/libltdl/lt_mutex.h
@@ -0,1 +1,50 @@
+/* lt_mutex.h -- mutex locking interface
+   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+   Originally by Gary V. Vaughan <address@hidden>
+
+   NOTE: The canonical source of this file is maintained with the
+   GNU Libtool package.  Report bugs to address@hidden
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+As a special exception to the GNU Lesser General Public License,
+if you distribute this file as part of a program or library that
+is built using GNU libtool, you may include it under the same
+distribution terms that you use for the rest of that program.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free
+Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307  USA
+*/
+
+/* Only include this header file once. */
+#ifndef LT_MUTEX_H
+#define LT_MUTEX_H 1
+
+#include <libltdl/lt_system.h>
+
+LT_BEGIN_C_DECLS
+
+typedef void   lt_dlmutex_lock         (void);
+typedef void   lt_dlmutex_unlock       (void);
+typedef void   lt_dlmutex_seterror     (const char *errmsg);
+typedef const char *lt_dlmutex_geterror        (void);
+
+LT_SCOPE int   lt_dlmutex_register     (lt_dlmutex_lock *lock,
+                                        lt_dlmutex_unlock *unlock,
+                                        lt_dlmutex_seterror *seterror,
+                                        lt_dlmutex_geterror *geterror);
+
+LT_END_C_DECLS
+
+#endif /*!LT_MUTEX_H*/
--- orig/libltdl/lt__private.h
+++ mod/libltdl/lt__private.h
@@ -54,11 +54,13 @@
 #  include <memory.h>
 #endif

+/* Import internal interfaces...  */
 #include "lt__alloc.h"
 #include "lt__dirent.h"
 #include "lt__glibc.h"
 #include "lt__pre89.h"
-#include "lt_system.h"
+
+/* ...and all exported interfaces.  */
 #include "ltdl.h"

 #if WITH_DMALLOC
@@ -71,12 +73,66 @@
 #  define LT_GLOBAL_DATA
 #endif

+
 LT_BEGIN_C_DECLS

 #ifndef errno
 extern int errno;
 #endif

+
+
+/* --- ERROR HANDLING --- */
+
+/* Extract the diagnostic strings from the error table macro in the same
+   order as the enumerated indices in lt_error.h. */
+
+static const char *lt__error_strings[] =
+  {
+#define LT_ERROR(name, diagnostic)     (diagnostic),
+    lt_dlerror_table
+#undef LT_ERROR
+
+    0
+  };
+
+#define LT__STRERROR(name)     lt__error_strings[LT_CONC(LT_ERROR_,name)]
+
+
+
+/* --- MUTEX LOCKING --- */
+
+/* Macros to make it easier to run the lock functions only if they have
+   been registered.  The reason for the complicated lock macro is to
+   ensure that the stored error message from the last error is not
+   accidentally erased if the current function doesn't generate an
+   error of its own.  */
+
+#define LT__MUTEX_LOCK()                       LT_STMT_START { \
+       if (lt__mutex_lock_func) (*lt__mutex_lock_func)();      \
+                                               } LT_STMT_END
+#define LT__MUTEX_UNLOCK()                     LT_STMT_START { \
+       if (lt__mutex_unlock_func) (*lt__mutex_unlock_func)();\
+                                               } LT_STMT_END
+#define LT__MUTEX_SETERRORSTR(errormsg)                LT_STMT_START { \
+       if (lt__mutex_seterror_func)                            \
+               (*lt__mutex_seterror_func) (errormsg);          \
+       else    lt__last_error = (errormsg);    } LT_STMT_END
+#define LT__MUTEX_GETERROR(errormsg)           LT_STMT_START { \
+       if (lt__mutex_seterror_func)                            \
+               (errormsg) = (*lt__mutex_geterror_func) ();     \
+       else    (errormsg) = lt__last_error;    } LT_STMT_END
+#define LT__MUTEX_SETERROR(errorcode)                          \
+       LT__MUTEX_SETERRORSTR(LT__STRERROR(errorcode))
+
+/* The mutex functions stored here are global, and are necessarily the
+   same for all threads that wish to share access to libltdl.  */
+LT_SCOPE lt_dlmutex_lock       *lt__mutex_lock_func;
+LT_SCOPE lt_dlmutex_unlock     *lt__mutex_unlock_func;
+LT_SCOPE lt_dlmutex_seterror   *lt__mutex_seterror_func;
+LT_SCOPE lt_dlmutex_geterror   *lt__mutex_geterror_func;
+LT_SCOPE const char            *lt__last_error;
+
 LT_END_C_DECLS

 #endif /*!LT__PRIVATE_H*/
--- orig/libltdl/lt_system.h
+++ mod/libltdl/lt_system.h
@@ -94,6 +94,23 @@
 #endif


+/* DLL building support on win32 hosts;  mostly to workaround their
+   ridiculous implementation of data symbol exporting. */
+#ifndef LT_SCOPE
+#  ifdef __WINDOWS__
+#    ifdef DLL_EXPORT          /* defined by libtool (if required) */
+#      define LT_SCOPE __declspec(dllexport)
+#    endif
+#    ifdef LIBLTDL_DLL_IMPORT  /* define if linking with this dll */
+#      define LT_SCOPE extern __declspec(dllimport)
+#    endif
+#  endif
+#  ifndef LT_SCOPE             /* static linking or !__WINDOWS__ */
+#    define LT_SCOPE   extern
+#  endif
+#endif
+
+
 #ifdef __WINDOWS__
 /* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
    separator when it is set. */
--- orig/libltdl/ltdl.c
+++ mod/libltdl/ltdl.c
@@ -72,18 +72,6 @@
 /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */


-/* Extract the diagnostic strings from the error table macro in the same
-   order as the enumerated indices in ltdl.h. */
-
-static const char *lt_dlerror_strings[] =
-  {
-#define LT_ERROR(name, diagnostic)     (diagnostic),
-    lt_dlerror_table
-#undef LT_ERROR
-
-    0
-  };
-
 /* This structure is used for the list of registered loaders. */
 struct lt_dlloader {
   struct lt_dlloader   *next;
@@ -119,8 +107,6 @@
 #define LT_DLIS_RESIDENT(handle)    LT_DLGET_FLAG(handle, LT_DLRESIDENT_FLAG)


-#define LT_DLSTRERROR(name)    lt_dlerror_strings[LT_CONC(LT_ERROR_,name)]
-
 static const char      objdir[]                = LTDL_OBJDIR;
 static const char      archive_ext[]           = LTDL_ARCHIVE_EXT;
 #ifdef LTDL_SHLIB_EXT
@@ -131,139 +117,6 @@
 #endif


-
-/* --- MUTEX LOCKING --- */
-
-
-/* Macros to make it easier to run the lock functions only if they have
-   been registered.  The reason for the complicated lock macro is to
-   ensure that the stored error message from the last error is not
-   accidentally erased if the current function doesn't generate an
-   error of its own.  */
-#define LT_DLMUTEX_LOCK()                      LT_STMT_START { \
-       if (lt_dlmutex_lock_func) (*lt_dlmutex_lock_func)();    \
-                                               } LT_STMT_END
-#define LT_DLMUTEX_UNLOCK()                    LT_STMT_START { \
-       if (lt_dlmutex_unlock_func) (*lt_dlmutex_unlock_func)();\
-                                               } LT_STMT_END
-#define LT_DLMUTEX_SETERROR(errormsg)          LT_STMT_START { \
-       if (lt_dlmutex_seterror_func)                           \
-               (*lt_dlmutex_seterror_func) (errormsg);         \
-       else    lt_dllast_error = (errormsg);   } LT_STMT_END
-#define LT_DLMUTEX_GETERROR(errormsg)          LT_STMT_START { \
-       if (lt_dlmutex_seterror_func)                           \
-               (errormsg) = (*lt_dlmutex_geterror_func) ();    \
-       else    (errormsg) = lt_dllast_error;   } LT_STMT_END
-
-/* The mutex functions stored here are global, and are necessarily the
-   same for all threads that wish to share access to libltdl.  */
-static lt_dlmutex_lock     *lt_dlmutex_lock_func     = 0;
-static lt_dlmutex_unlock   *lt_dlmutex_unlock_func   = 0;
-static lt_dlmutex_seterror *lt_dlmutex_seterror_func = 0;
-static lt_dlmutex_geterror *lt_dlmutex_geterror_func = 0;
-static const char          *lt_dllast_error          = 0;
-
-
-/* Either set or reset the mutex functions.  Either all the arguments must
-   be valid functions, or else all can be NULL to turn off locking entirely.
-   The registered functions should be manipulating a static global lock
-   from the lock() and unlock() callbacks, which needs to be reentrant.  */
-int
-lt_dlmutex_register (lt_dlmutex_lock *lock, lt_dlmutex_unlock *unlock,
-    lt_dlmutex_seterror *seterror, lt_dlmutex_geterror *geterror)
-{
-  lt_dlmutex_unlock *old_unlock = unlock;
-  int               errors     = 0;
-
-  /* Lock using the old lock() callback, if any.  */
-  LT_DLMUTEX_LOCK ();
-
-  if ((lock && unlock && seterror && geterror)
-      || !(lock || unlock || seterror || geterror))
-    {
-      lt_dlmutex_lock_func     = lock;
-      lt_dlmutex_unlock_func   = unlock;
-      lt_dlmutex_geterror_func = geterror;
-    }
-  else
-    {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_MUTEX_ARGS));
-      ++errors;
-    }
-
-  /* Use the old unlock() callback we saved earlier, if any.  Otherwise
-     record any errors using internal storage.  */
-  if (old_unlock)
-    (*old_unlock) ();
-
-  /* Return the number of errors encountered during the execution of
-     this function.  */
-  return errors;
-}
-
-
-
-
-/* --- ERROR HANDLING --- */
-
-
-static const char    **user_error_strings      = 0;
-static int             errorcount              = LT_ERROR_MAX;
-
-int
-lt_dladderror (const char *diagnostic)
-{
-  int          errindex = 0;
-  int          result   = -1;
-  const char  **temp     = (const char **) 0;
-
-  assert (diagnostic);
-
-  LT_DLMUTEX_LOCK ();
-
-  errindex = errorcount - LT_ERROR_MAX;
-  temp = REALLOC (const char *, user_error_strings, 1 + errindex);
-  if (temp)
-    {
-      user_error_strings               = temp;
-      user_error_strings[errindex]     = diagnostic;
-      result                           = errorcount++;
-    }
-
-  LT_DLMUTEX_UNLOCK ();
-
-  return result;
-}
-
-int
-lt_dlseterror (int errindex)
-{
-  int          errors   = 0;
-
-  LT_DLMUTEX_LOCK ();
-
-  if (errindex >= errorcount || errindex < 0)
-    {
-      /* Ack!  Error setting the error message! */
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_ERRORCODE));
-      ++errors;
-    }
-  else if (errindex < LT_ERROR_MAX)
-    {
-      /* No error setting the error message! */
-      LT_DLMUTEX_SETERROR (lt_dlerror_strings[errindex]);
-    }
-  else
-    {
-      /* No error setting the error message! */
-      LT_DLMUTEX_SETERROR (user_error_strings[errindex - LT_ERROR_MAX]);
-    }
-
-  LT_DLMUTEX_UNLOCK ();
-
-  return errors;
-}
-


 /* --- DLOPEN() INTERFACE LOADER --- */
@@ -308,7 +161,7 @@
 #if HAVE_DLERROR
 #  define DLERROR(arg) dlerror ()
 #else
-#  define DLERROR(arg) LT_DLSTRERROR (arg)
+#  define DLERROR(arg) LT__STRERROR (arg)
 #endif

 static lt_module
@@ -318,7 +171,7 @@

   if (!module)
     {
-      LT_DLMUTEX_SETERROR (DLERROR (CANNOT_OPEN));
+      LT__MUTEX_SETERRORSTR (DLERROR (CANNOT_OPEN));
     }

   return module;
@@ -331,7 +184,7 @@

   if (dlclose (module) != 0)
     {
-      LT_DLMUTEX_SETERROR (DLERROR (CANNOT_CLOSE));
+      LT__MUTEX_SETERRORSTR (DLERROR (CANNOT_CLOSE));
       ++errors;
     }

@@ -345,7 +198,7 @@

   if (!address)
     {
-      LT_DLMUTEX_SETERROR (DLERROR (SYMBOL_NOT_FOUND));
+      LT__MUTEX_SETERRORSTR (DLERROR (SYMBOL_NOT_FOUND));
     }

   return address;
@@ -441,7 +294,7 @@

       if (!module)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN));
+         LT__MUTEX_SETERROR (CANNOT_OPEN);
        }
     }

@@ -455,7 +308,7 @@

   if (module && (shl_unload ((shl_t) (module)) != 0))
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE));
+      LT__MUTEX_SETERROR (CANNOT_CLOSE);
       ++errors;
     }

@@ -470,13 +323,13 @@
   /* sys_shl_open should never return a NULL module handle */
   if (module == (lt_module) 0)
   {
-    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+    LT__MUTEX_SETERROR (INVALID_HANDLE);
   }
   else if (!shl_findsym((shl_t*) &module, symbol, TYPE_UNDEFINED, &address))
     {
       if (!address)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+         LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
        }
     }

@@ -560,7 +413,7 @@
      We check whether LoadLibrary is returning a handle to
      an already loaded module, and simulate failure if we
      find one. */
-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   cur = handles;
   while (cur)
     {
@@ -577,11 +430,11 @@

       cur = cur->next;
   }
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   if (cur || !module)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN));
+      LT__MUTEX_SETERROR (CANNOT_OPEN);
       module = 0;
     }

@@ -595,7 +448,7 @@

   if (FreeLibrary(module) == 0)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE));
+      LT__MUTEX_SETERROR (CANNOT_CLOSE);
       ++errors;
     }

@@ -609,7 +462,7 @@

   if (!address)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+      LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
     }

   return address;
@@ -652,7 +505,7 @@

   if (image <= 0)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN));
+      LT__MUTEX_SETERROR (CANNOT_OPEN);
       image = 0;
     }

@@ -666,7 +519,7 @@

   if (unload_add_on ((image_id) module) != B_OK)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE));
+      LT__MUTEX_SETERROR (CANNOT_CLOSE);
       ++errors;
     }

@@ -681,7 +534,7 @@

   if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+      LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
       address = 0;
     }

@@ -715,7 +568,7 @@

   if (dld_link (filename) != 0)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN));
+      LT__MUTEX_SETERROR (CANNOT_OPEN);
       FREE (module);
     }

@@ -729,7 +582,7 @@

   if (dld_unlink_by_file ((char*)(module), 1) != 0)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE));
+      LT__MUTEX_SETERROR (CANNOT_CLOSE);
       ++errors;
     }
   else
@@ -747,7 +600,7 @@

   if (!address)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+      LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
     }

   return address;
@@ -988,10 +841,10 @@
                                break;
                        }
                default:
-                       LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_OPEN)));
+                       LT__MUTEX_SETERRORSTR 
(lt_int_dyld_error(LT__STRERROR(CANNOT_OPEN)));
                        return 0;
        }
-       if (!module) LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_OPEN)));
+       if (!module) LT__MUTEX_SETERRORSTR 
(lt_int_dyld_error(LT__STRERROR(CANNOT_OPEN)));
   return module;
 }

@@ -1007,7 +860,7 @@
     if (((struct mach_header *)module)->magic == MH_CIGAM)
 #endif
        {
-         LT_DLMUTEX_SETERROR("Can not close a dylib");
+         LT__MUTEX_SETERRORSTR("Can not close a dylib");
          retCode = 1;
        }
        else
@@ -1030,7 +883,7 @@
                if (!NSUnLinkModule(module,flags))
                {
                        retCode=1;
-                       LT_DLMUTEX_SETERROR 
(lt_int_dyld_error(LT_DLSTRERROR(CANNOT_CLOSE)));
+                       LT__MUTEX_SETERRORSTR 
(lt_int_dyld_error(LT__STRERROR(CANNOT_CLOSE)));
                }
        }

@@ -1075,14 +928,14 @@
        }
        if (!nssym)
        {
-               strncpy(saveError, 
lt_int_dyld_error(LT_DLSTRERROR(SYMBOL_NOT_FOUND)), 255);
+               strncpy(saveError, 
lt_int_dyld_error(LT__STRERROR(SYMBOL_NOT_FOUND)), 255);
                saveError[255] = 0;
                if (!mh) mh=lt_int_dyld_get_mach_header_from_nsmodule(module);
                nssym = lt_int_dyld_NSlookupSymbolInLinkedLibs(symbol,mh);
        }
        if (!nssym)
        {
-               LT_DLMUTEX_SETERROR (saveError);
+               LT__MUTEX_SETERRORSTR (saveError);
                return NULL;
        }
        return NSAddressOfSymbol(nssym);
@@ -1114,7 +967,7 @@
 {
   int errors = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   preloaded_symbols = 0;
   if (default_preloaded_symbols)
@@ -1122,7 +975,7 @@
       errors = lt_dlpreload (default_preloaded_symbols);
     }

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -1132,7 +985,7 @@
 {
   lt_dlsymlists_t *lists;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   lists = preloaded_symbols;
   while (lists)
@@ -1144,7 +997,7 @@
     }
   preloaded_symbols = 0;

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return 0;
 }
@@ -1163,7 +1016,7 @@
   lt_dlsymlists_t *lists;
   int             errors   = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   lists = preloaded_symbols;
   while (lists)
@@ -1189,7 +1042,7 @@
     }

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();
   return errors;
 }

@@ -1199,12 +1052,12 @@
   lt_dlsymlists_t *lists;
   lt_module       module = (lt_module) 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   lists = preloaded_symbols;

   if (!lists)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_SYMBOLS));
+      LT__MUTEX_SETERROR (NO_SYMBOLS);
       goto done;
     }

@@ -1234,10 +1087,10 @@
       lists = lists->next;
     }

-  LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
+  LT__MUTEX_SETERROR (FILE_NOT_FOUND);

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();
   return module;
 }

@@ -1265,7 +1118,7 @@
     ++syms;
   }

-  LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+  LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);

   return 0;
 }
@@ -1339,7 +1192,7 @@
 void
 lt__alloc_die_callback (void)
 {
-  LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
+  LT__MUTEX_SETERROR (NO_MEMORY);
 }

 /* Initialize libltdl. */
@@ -1348,7 +1201,7 @@
 {
   int        errors   = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   /* Initialize only at first call. */
   if (++initialized == 1)
@@ -1386,17 +1239,17 @@

       if (presym_init (presym.dlloader_data))
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INIT_LOADER));
+         LT__MUTEX_SETERROR (INIT_LOADER);
          ++errors;
        }
       else if (errors != 0)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (DLOPEN_NOT_SUPPORTED));
+         LT__MUTEX_SETERROR (DLOPEN_NOT_SUPPORTED);
          ++errors;
        }
     }

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -1414,12 +1267,12 @@
     {
       presym_free_symlists();

-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       if (default_preloaded_symbols)
        {
          errors = lt_dlpreload (default_preloaded_symbols);
        }
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }

   return errors;
@@ -1428,9 +1281,9 @@
 int
 lt_dlpreload_default (const lt_dlsymlist *preloaded)
 {
-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   default_preloaded_symbols = preloaded;
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();
   return 0;
 }

@@ -1441,12 +1294,12 @@
   lt_dlloader *loader;
   int         errors   = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   loader = loaders;

   if (!initialized)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SHUTDOWN));
+      LT__MUTEX_SETERROR (SHUTDOWN);
       ++errors;
       goto done;
     }
@@ -1502,7 +1355,7 @@
     }

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();
   return errors;
 }

@@ -1514,8 +1367,8 @@
   const char   *saved_error;
   int           errors         = 0;

-  LT_DLMUTEX_GETERROR (saved_error);
-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_GETERROR (saved_error);
+  LT__MUTEX_LOCK ();

   cur   = handles;
   loader = loaders;
@@ -1555,7 +1408,7 @@
         file_not_found() can detect what happened.
       if (access (filename, R_OK) != 0)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
+         LT__MUTEX_SETERROR (FILE_NOT_FOUND);
          ++errors;
          goto done;
        } */
@@ -1593,10 +1446,10 @@
     }

   cur->loader  = loader;
-  LT_DLMUTEX_SETERROR (saved_error);
+  LT__MUTEX_SETERRORSTR (saved_error);

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -1766,10 +1619,10 @@
       switch (error)
        {
        case ENOMEM:
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
+         LT__MUTEX_SETERROR (NO_MEMORY);
          break;
        default:
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (UNKNOWN));
+         LT__MUTEX_SETERROR (UNKNOWN);
          break;
        }

@@ -1795,11 +1648,11 @@
   char *filename       = 0;
   char *canonical      = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   if (!search_path || !*search_path)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
+      LT__MUTEX_SETERROR (FILE_NOT_FOUND);
       goto cleanup;
     }

@@ -1846,7 +1699,7 @@
   FREE (canonical);
   FREE (filename);

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return result;
 }
@@ -1944,7 +1797,7 @@
     }
   ++errors;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   if (user_search_path)
     {
       save_search_path = lt__strdup (user_search_path);
@@ -1990,7 +1843,7 @@
   /* restore the old search path */
   MEMREASSIGN (user_search_path, save_search_path);

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   if (!depcount)
     {
@@ -2147,7 +2000,7 @@
   assert (phandle);
   assert (*phandle == 0);

-  LT_DLMUTEX_GETERROR (saved_error);
+  LT__MUTEX_GETERROR (saved_error);

   /* dlopen self? */
   if (!filename)
@@ -2256,11 +2109,11 @@
        {
          const char *search_path;

-         LT_DLMUTEX_LOCK ();
+         LT__MUTEX_LOCK ();
          search_path = user_search_path;
          if (search_path)
            file = find_file (user_search_path, base_name, &dir);
-         LT_DLMUTEX_UNLOCK ();
+         LT__MUTEX_UNLOCK ();

          if (!file)
            {
@@ -2293,7 +2146,7 @@
         the status flag, and bail out.  */
       if (!file)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
+         LT__MUTEX_SETERROR (FILE_NOT_FOUND);
          ++errors;
          goto cleanup;
        }
@@ -2503,13 +2356,13 @@
       (*phandle)->info.ref_count       = 1;
       MEMREASSIGN ((*phandle)->info.name, name);

-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       (*phandle)->next         = handles;
       handles                  = *phandle;
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }

-  LT_DLMUTEX_SETERROR (saved_error);
+  LT__MUTEX_SETERRORSTR (saved_error);

  cleanup:
   FREE (dir);
@@ -2539,8 +2392,8 @@
 {
   const char *error = 0;

-  LT_DLMUTEX_GETERROR (error);
-  if (error == LT_DLSTRERROR (FILE_NOT_FOUND))
+  LT__MUTEX_GETERROR (error);
+  if (error == LT__STRERROR (FILE_NOT_FOUND))
     return 1;

   return 0;
@@ -2630,7 +2483,7 @@

   /* Still here?  Then we really did fail to locate any of the file
      names we tried.  */
-  LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND));
+  LT__MUTEX_SETERROR (FILE_NOT_FOUND);
   FREE (tmp);
   return 0;
 }
@@ -2647,10 +2500,10 @@
       switch (error)
        {
        case ENOMEM:
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
+         LT__MUTEX_SETERROR (NO_MEMORY);
          break;
        default:
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (UNKNOWN));
+         LT__MUTEX_SETERROR (UNKNOWN);
          break;
        }
       return 1;
@@ -2863,7 +2716,7 @@
   lt_dlhandle cur, last;
   int errors = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   /* check whether the handle is valid */
   last = cur = handles;
@@ -2875,7 +2728,7 @@

   if (!cur)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+      LT__MUTEX_SETERROR (INVALID_HANDLE);
       ++errors;
       goto done;
     }
@@ -2914,12 +2767,12 @@

   if (LT_DLIS_RESIDENT (handle))
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CLOSE_RESIDENT_MODULE));
+      LT__MUTEX_SETERROR (CLOSE_RESIDENT_MODULE);
       ++errors;
     }

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -2935,13 +2788,13 @@

   if (!handle)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+      LT__MUTEX_SETERROR (INVALID_HANDLE);
       return 0;
     }

   if (!symbol)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
+      LT__MUTEX_SETERROR (SYMBOL_NOT_FOUND);
       return 0;
     }

@@ -2957,7 +2810,7 @@
       sym = MALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1);
       if (!sym)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (BUFFER_OVERFLOW));
+         LT__MUTEX_SETERROR (BUFFER_OVERFLOW);
          return 0;
        }
     }
@@ -2967,7 +2820,7 @@
     {
       const char *saved_error;

-      LT_DLMUTEX_GETERROR (saved_error);
+      LT__MUTEX_GETERROR (saved_error);

       /* this is a libtool module */
       if (handle->loader->sym_prefix)
@@ -2993,7 +2846,7 @@
            }
          return address;
        }
-      LT_DLMUTEX_SETERROR (saved_error);
+      LT__MUTEX_SETERRORSTR (saved_error);
     }

   /* otherwise try "symbol" */
@@ -3021,8 +2874,8 @@
 {
   const char *error;

-  LT_DLMUTEX_GETERROR (error);
-  LT_DLMUTEX_SETERROR (0);
+  LT__MUTEX_GETERROR (error);
+  LT__MUTEX_SETERRORSTR (0);

   return error ? error : NULL;
 }
@@ -3103,10 +2956,10 @@

   if (search_dir && *search_dir)
     {
-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       if (lt_dlpath_insertdir (&user_search_path, 0, search_dir) != 0)
        ++errors;
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }

   return errors;
@@ -3119,26 +2972,26 @@

   if (before)
     {
-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       if ((before < user_search_path)
          || (before >= user_search_path + LT_STRLEN (user_search_path)))
        {
-         LT_DLMUTEX_UNLOCK ();
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_POSITION));
+         LT__MUTEX_UNLOCK ();
+         LT__MUTEX_SETERROR (INVALID_POSITION);
          return 1;
        }
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }

   if (search_dir && *search_dir)
     {
-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       if (lt_dlpath_insertdir (&user_search_path,
                               (char *) before, search_dir) != 0)
        {
          ++errors;
        }
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }

   return errors;
@@ -3149,19 +3002,19 @@
 {
   int   errors     = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   FREE (user_search_path);
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   if (!search_path || !LT_STRLEN (search_path))
     {
       return errors;
     }

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   if (canonicalize_path (search_path, &user_search_path) != 0)
     ++errors;
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -3171,9 +3024,9 @@
 {
   const char *saved_path;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   saved_path = user_search_path;
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return saved_path;
 }
@@ -3185,7 +3038,7 @@

   if (!handle)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+      LT__MUTEX_SETERROR (INVALID_HANDLE);
       ++errors;
     }
   else
@@ -3201,7 +3054,7 @@
 {
   if (!handle)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+      LT__MUTEX_SETERROR (INVALID_HANDLE);
       return -1;
     }

@@ -3218,7 +3071,7 @@
 {
   if (!handle)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE));
+      LT__MUTEX_SETERROR (INVALID_HANDLE);
       return 0;
     }

@@ -3255,7 +3108,7 @@
   int errors = 0;
   lt_dlhandle cur;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   cur = handles;
   while (cur)
@@ -3270,7 +3123,7 @@
        }
     }

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -3281,9 +3134,9 @@
   static lt_dlcaller_id last_caller_id = 0;
   int result;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   result = ++last_caller_id;
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return result;
 }
@@ -3297,7 +3150,7 @@

   /* This needs to be locked so that the caller data can be updated
      simultaneously by different threads.  */
-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   if (handle->caller_data)
     while (handle->caller_data[n_elements].key)
@@ -3335,7 +3188,7 @@
   handle->caller_data[i].data = data;

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return stale;
 }
@@ -3347,7 +3200,7 @@

   /* This needs to be locked so that the caller data isn't updated by
      another thread part way through this function.  */
-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   /* Locate the index of the element with a matching KEY.  */
   {
@@ -3362,7 +3215,7 @@
       }
   }

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return result;
 }
@@ -3384,7 +3237,7 @@
       || (dlloader->module_close == 0)
       || (dlloader->find_sym == 0))
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER));
+      LT__MUTEX_SETERROR (INVALID_LOADER);
       return 1;
     }

@@ -3402,7 +3255,7 @@
   node->find_sym       = dlloader->find_sym;
   node->dlloader_data  = dlloader->dlloader_data;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   if (!loaders)
     {
       /* If there are no loaders, NODE becomes the list! */
@@ -3435,7 +3288,7 @@

       if (ptr->next != place)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER));
+         LT__MUTEX_SETERROR (INVALID_LOADER);
          ++errors;
        }
       else
@@ -3446,7 +3299,7 @@
        }
     }

-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -3460,18 +3313,18 @@

   if (!place)
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER));
+      LT__MUTEX_SETERROR (INVALID_LOADER);
       return 1;
     }

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();

   /* Fail if there are any open modules which use this loader. */
   for  (handle = handles; handle; handle = handle->next)
     {
       if (handle->loader == place)
        {
-         LT_DLMUTEX_SETERROR (LT_DLSTRERROR (REMOVE_LOADER));
+         LT__MUTEX_SETERROR (REMOVE_LOADER);
          ++errors;
          goto done;
        }
@@ -3506,7 +3359,7 @@
   FREE (place);

  done:
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return errors;
 }
@@ -3516,9 +3369,9 @@
 {
   lt_dlloader *next;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   next = place ? place->next : loaders;
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return next;
 }
@@ -3530,13 +3383,13 @@

   if (place)
     {
-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       name = place ? place->loader_name : 0;
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }
   else
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER));
+      LT__MUTEX_SETERROR (INVALID_LOADER);
     }

   return name;
@@ -3549,13 +3402,13 @@

   if (place)
     {
-      LT_DLMUTEX_LOCK ();
+      LT__MUTEX_LOCK ();
       data = place ? &(place->dlloader_data) : 0;
-      LT_DLMUTEX_UNLOCK ();
+      LT__MUTEX_UNLOCK ();
     }
   else
     {
-      LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER));
+      LT__MUTEX_SETERROR (INVALID_LOADER);
     }

   return data;
@@ -3566,7 +3419,7 @@
 {
   lt_dlloader *place = 0;

-  LT_DLMUTEX_LOCK ();
+  LT__MUTEX_LOCK ();
   for (place = loaders; place; place = place->next)
     {
       if (strcmp (place->loader_name, loader_name) == 0)
@@ -3574,7 +3427,7 @@
          break;
        }
     }
-  LT_DLMUTEX_UNLOCK ();
+  LT__MUTEX_UNLOCK ();

   return place;
 }
--- orig/libltdl/ltdl.h
+++ mod/libltdl/ltdl.h
@@ -31,29 +31,12 @@
 #define LTDL_H 1

 #include <libltdl/lt_system.h>
+#include <libltdl/lt_error.h>
+#include <libltdl/lt_mutex.h>

 LT_BEGIN_C_DECLS


-/* DLL building support on win32 hosts;  mostly to workaround their
-   ridiculous implementation of data symbol exporting. */
-#ifndef LT_SCOPE
-#  ifdef __WINDOWS__
-#    ifdef DLL_EXPORT          /* defined by libtool (if required) */
-#      define LT_SCOPE __declspec(dllexport)
-#    endif
-#    ifdef LIBLTDL_DLL_IMPORT  /* define if linking with this dll */
-#      define LT_SCOPE extern __declspec(dllimport)
-#    endif
-#  endif
-#  ifndef LT_SCOPE             /* static linking or !__WINDOWS__ */
-#    define LT_SCOPE   extern
-#  endif
-#endif
-
-
-
-
 /* LT_STRLEN can be used safely on NULL pointers.  */
 #define LT_STRLEN(s)   (((s) && (s)[0]) ? strlen (s) : 0)

@@ -93,22 +76,6 @@



-/* --- MUTEX LOCKING --- */
-
-
-typedef void   lt_dlmutex_lock         (void);
-typedef void   lt_dlmutex_unlock       (void);
-typedef void   lt_dlmutex_seterror     (const char *errmsg);
-typedef const char *lt_dlmutex_geterror        (void);
-
-LT_SCOPE int   lt_dlmutex_register     (lt_dlmutex_lock *lock,
-                                        lt_dlmutex_unlock *unlock,
-                                        lt_dlmutex_seterror *seterror,
-                                        lt_dlmutex_geterror *geterror);
-
-
-
-
 /* --- PRELOADED MODULE SUPPORT --- */


@@ -195,49 +162,6 @@



-/* --- ERROR MESSAGE HANDLING --- */
-
-
-/* Defining error strings alongside their symbolic names in a macro in
-   this way allows us to expand the macro in different contexts with
-   confidence that the enumeration of symbolic names will map correctly
-   onto the table of error strings.  */
-#define lt_dlerror_table                                               \
-    LT_ERROR(UNKNOWN,              "unknown error")                    \
-    LT_ERROR(DLOPEN_NOT_SUPPORTED,  "dlopen support not available")    \
-    LT_ERROR(INVALID_LOADER,       "invalid loader")                   \
-    LT_ERROR(INIT_LOADER,          "loader initialization failed")     \
-    LT_ERROR(REMOVE_LOADER,        "loader removal failed")            \
-    LT_ERROR(FILE_NOT_FOUND,       "file not found")                   \
-    LT_ERROR(DEPLIB_NOT_FOUND,      "dependency library not found")    \
-    LT_ERROR(NO_SYMBOLS,           "no symbols defined")               \
-    LT_ERROR(CANNOT_OPEN,          "can't open the module")            \
-    LT_ERROR(CANNOT_CLOSE,         "can't close the module")           \
-    LT_ERROR(SYMBOL_NOT_FOUND,      "symbol not found")                        
\
-    LT_ERROR(NO_MEMORY,                    "not enough memory")                
\
-    LT_ERROR(INVALID_HANDLE,       "invalid module handle")            \
-    LT_ERROR(BUFFER_OVERFLOW,      "internal buffer overflow")         \
-    LT_ERROR(INVALID_ERRORCODE,     "invalid errorcode")               \
-    LT_ERROR(SHUTDOWN,             "library already shutdown")         \
-    LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module")     \
-    LT_ERROR(INVALID_MUTEX_ARGS,    "invalid mutex handler registration") \
-    LT_ERROR(INVALID_POSITION,     "invalid search path insert position")
-
-/* Enumerate the symbolic error names. */
-enum {
-#define LT_ERROR(name, diagnostic)     LT_CONC(LT_ERROR_, name),
-       lt_dlerror_table
-#undef LT_ERROR
-
-       LT_ERROR_MAX
-};
-
-/* These functions are only useful from inside custom module loaders. */
-LT_SCOPE int   lt_dladderror   (const char *diagnostic);
-LT_SCOPE int   lt_dlseterror   (int errorcode);
-
-
-
 /* --- BINARY COMPATIBILITY WITH OLD LIBLTDL --- */

 LT_SCOPE void * (*lt_dlmalloc) (size_t size);
--- orig/libltdl/Makefile.am
+++ mod/libltdl/Makefile.am
@@ -26,7 +26,7 @@

 if INSTALL_LTDL
 include_HEADERS = ltdl.h
-pkginclude_HEADERS = lt_system.h
+pkginclude_HEADERS = lt_system.h lt_error.h lt_mutex.h
 lib_LTLIBRARIES = libltdl.la
 endif

@@ -39,6 +39,7 @@
 CLEANFILES         = libltdl.la libltdlc.la

 libltdl_la_SOURCES  = ltdl.h ltdl.c \
+                     lt_error.h lt_error.c lt_mutex.h lt_mutex.c \
                      lt__private.h lt__alloc.h lt__alloc.c \
                      lt__pre89.h lt__glibc.h argz.h lt__dirent.h \
                      lt_system.h

reply via email to

[Prev in Thread] Current Thread [Next in Thread]