libtool-patches
[Top][All Lists]
Advanced

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

Two small libltdl patches.


From: Peter O'Gorman
Subject: Two small libltdl patches.
Date: Sat, 23 Aug 2008 16:59:00 -0500
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Hi,

On systems without argz we were exporting unmangled symbols argz_count
and argz_add from libltdl. Not really a good idea. Rather than mangle
the names, since we do not use either function, they were removed.

And as Ralf reported previously, preloaded modules can have the ".lib"
extension as well as ".a".

Does not fail any unexpected tests on darwin or linux with these patches.

I'm thinking of just pushing these as obvious....

Oh what the heck, not like I am going to have time to make a release in
the next couple of days anyway.

Ok to commit?

Peter
-- 
Peter O'Gorman
http://pogma.com
>From 1fa70a57ef579ae717c504346a1aad13a03b30cc Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <address@hidden>
Date: Sat, 23 Aug 2008 16:28:25 -0500
Subject: [PATCH] Remove unnecessary global argz functions.

* libltdl/argz.c (argz_add,argz_count): Remove.
Reported by Ralf Wildenhues <address@hidden>.
---
 ChangeLog      |    6 ++++++
 libltdl/argz.c |   28 ----------------------------
 2 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 13cc2af..567fbfd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-23  Peter O'Gorman  <address@hidden>
+
+       Remove unnecessary global argz functions.
+       * libltdl/argz.c (argz_add,argz_count): Remove.
+       Reported by Ralf Wildenhues <address@hidden>.
+
 2008-08-22  Ralf Wildenhues  <address@hidden>
 
        Initial support for Lahey Fortran on GNU/Linux.
diff --git a/libltdl/argz.c b/libltdl/argz.c
index f31ce17..8567723 100644
--- a/libltdl/argz.c
+++ b/libltdl/argz.c
@@ -76,14 +76,6 @@ argz_append (char **pargz, size_t *pargz_len, const char 
*buf, size_t buf_len)
 }
 
 
-/* Add a string to the argz vector.  */
-error_t
-argz_add (char **pargz, size_t *pargz_len, const char *str)
-{
-  return argz_append (pargz, pargz_len, str, strlen (str) + 1);
-}
-
-
 error_t
 argz_create_sep (const char *str, int delim, char **pargz, size_t *pargz_len)
 {
@@ -232,23 +224,3 @@ argz_stringify (char *argz, size_t argz_len, int sep)
     }
 }
 
-
-/* Count number of elements (null bytes) in argz vector.  */
-
-size_t
-argz_count (const char *argz, size_t argz_len)
-{
-  size_t count = 0;
-
-  assert ((argz && argz_len) || (!argz && !argz_len));
-
-  while (argz_len > 0)
-    {
-      size_t part_len = strlen (argz);
-      argz += part_len + 1;
-      argz_len -= part_len + 1;
-      count++;
-    }
-
-  return count;
-}
-- 
1.5.4.1

>From 38a2f1bcab8c64650b096830d1def5c6fb920c85 Mon Sep 17 00:00:00 2001
From: Peter O'Gorman <address@hidden>
Date: Sat, 23 Aug 2008 16:31:17 -0500
Subject: [PATCH] Allow for extensions other than .a for preloaded modules.

* libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define LT_LIBEXT.
* libltdl/ltdl.c (lt_dladvise_preload): Use it.
Reported by Ralf Wildenhues.
---
 ChangeLog          |    5 +++++
 libltdl/ltdl.c     |   10 ++++++++--
 libltdl/m4/ltdl.m4 |    2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 567fbfd..3dc46fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-08-23  Peter O'Gorman  <address@hidden>
 
+       Allow for extensions other than .a for preloaded modules.
+       * libltdl/m4/ltdl.m4 (_LTDL_SETUP): Define LT_LIBEXT.
+       * libltdl/ltdl.c (lt_dladvise_preload): Use it.
+       Reported by Ralf Wildenhues.
+
        Remove unnecessary global argz functions.
        * libltdl/argz.c (argz_add,argz_count): Remove.
        Reported by Ralf Wildenhues <address@hidden>.
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 5a26565..6e19599 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -50,6 +50,10 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #  define LT_FILENAME_MAX      1024
 #endif
 
+#if !defined(LT_LIBEXT)
+#  define LT_LIBEXT "a"
+#endif
+
 /* This is the maximum symbol size that won't require malloc/free */
 #undef LT_SYMBOL_LENGTH
 #define LT_SYMBOL_LENGTH       128
@@ -67,6 +71,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 
 static const char      objdir[]                = LT_OBJDIR;
 static const char      archive_ext[]           = LT_ARCHIVE_EXT;
+static  const char     libext[]                = LT_LIBEXT;
 #if defined(LT_MODULE_EXT)
 static const char      shlib_ext[]             = LT_MODULE_EXT;
 #endif
@@ -1258,7 +1263,8 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, 
const char *ext,
 
       if (vtable)
        {
-         archive_name = MALLOC (char, LT_STRLEN (name) + 3);
+         /* name + "." + libext + NULL */
+         archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) + 
2);
          *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
 
          if ((*phandle == NULL) || (archive_name == NULL))
@@ -1270,7 +1276,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, 
const char *ext,
 
          /* Preloaded modules are always named according to their old
             archive name.  */
-         sprintf (archive_name, "%s.a", name);
+         sprintf (archive_name, "%s.%s", name, libext);
 
          if (tryall_dlopen (&newhandle, archive_name, advise, vtable) == 0)
            {
diff --git a/libltdl/m4/ltdl.m4 b/libltdl/m4/ltdl.m4
index 563889e..bac721e 100644
--- a/libltdl/m4/ltdl.m4
+++ b/libltdl/m4/ltdl.m4
@@ -413,6 +413,8 @@ AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h 
mach-o/dyld.h dirent.h],
 AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])])
 AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])])
 
+AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
+
 name=ltdl
 LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`
 AC_SUBST([LTDLOPEN])
-- 
1.5.4.1


reply via email to

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