libtool-patches
[Top][All Lists]
Advanced

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

110bis-gary-rationalise-memory-management.patch


From: Gary V. Vaughan
Subject: 110bis-gary-rationalise-memory-management.patch
Date: Thu, 1 Apr 2004 15:22:48 +0100 (BST)
User-agent: mailnotify/0.2

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

This is a little more involved than the original, but I think
it addresses all of the concerns that were raised yesterday.

Apologies if it doesn't apply cleanly, but subversions appears to be
down again, so I generated it against my arch mirror with a hastily
hacked cvsapply script.

Okay to commit?
- -- 
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
_____________________________________________________________
This patch notification generated by cvsapply version 0.13tla
http://savannah.gnu.org/projects/cvs-utils
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFAbCW4FRMICSmD1gYRAnnjAKCk77RK4d+uxxSMWZZfCHW6OXbZzACeJKvt
hlkeUSh/WapRWJnda73zP7E=
=CSOb
-----END PGP SIGNATURE-----
* looking for address@hidden/libtool--devo--1.0--patch-29 to compare with
* comparing to address@hidden/libtool--devo--1.0--patch-29
A  libltdl/.arch-ids/lt__alloc.c.id
A  libltdl/.arch-ids/lt__alloc.h.id
A  libltdl/.arch-ids/lt_system.h.id
A  libltdl/lt__alloc.c
A  libltdl/lt__alloc.h
A  libltdl/lt_system.h
M  ChangeLog
M  NEWS
M  config/config.guess
M  config/config.sub
M  doc/libtool.texi
M  libltdl/Makefile.am
M  libltdl/ltdl.c
M  libltdl/ltdl.h

* modified files

--- orig/ChangeLog
+++ mod/ChangeLog
@@ -1,10 +1,50 @@
+2004-04-01  Gary V. Vaughan  <address@hidden>
+
+       There was no clean separation of abstraction layers in libltdl.
+       The first step in fixing this is to factor out the memory
+       management abstraction, making a start on removing promiscuity
+       from the underlying portability layer:
+
+       * doc/libtool.texi (Libltdl interface): Remove lt_dlmalloc,
+       lt_dlrealloc and lt_dlfree references.  The memory management
+       layer used by libltdl is now private.
+       * libltdl/lt_system.h: New installed header for system portability
+       abstraction.
+       * libltdl/ltdl.h: Use it.
+       * libltdl/lt__alloc.c, libltdl/lt__alloc.h: New module above
+       system portability layer to abstract ltdl's memory management.
+       * libltdl/ltdl.c: Use lt__alloc.h.
+       (closedir): Use free.
+       (opendir): Use malloc/free.
+       (lt__xalloc_die_callback): Report memory failures through
+       lt_dlerror.
+       (lt_dlinit): Use it to initialise memory management.
+       (LT_DLMALLOC, LT_DLREALLOC, LT_DLFREE, LT_EMALLOC, LT_EREALLOC)
+       (rpl_strdup, rpl_realloc, lt_estrdup, lt_emalloc, lt_erealloc):
+       Removed in favour of...
+       (lt__strdup, lt__memdup, MALLOC, REALLOC, FREE): ...these calls
+       from libltdl/lt__alloc.h.  Changed all callers.
+       (rpl_argz_append, rpl_argz_create_sep, rpl_argz_insert): As part
+       of the portability layer, these functions no longer use libltdl
+       memory management API.
+       (free_vars): Factored out.
+       (LT_DLMEM_REASSIGN): While redoing memory handling, renamed...
+       * libltdl/lt__alloc.h (MEMREASSIGN): ...to this.
+       * libltdl/Makefile.am (AUTOMAKE_OPTIONS): Let automake track
+       dependencies automatically.
+       (pkgincludedir): Override from parent package's setting.
+       (pkginclude_HEADERS): Install lt_system.h.
+       (libltdl_la_SOURCES): Add new files.
+       * NEWS: Updated.
+       Reported by Dalibor Topic <address@hidden>
+
 2004-04-01  Peter O'Gorman  <address@hidden>
 
        * ltmain.in: Remove an extra eval concat_cmds that some idiot added.
        Fixes double eval on AIX, reported by Albert Chin and Uwe Moeller.
 
        * NEWS: Add a news item about xlc support that I forgot yesterday.
-       
+
 2004-03-31  Peter O'Gorman  <address@hidden>
 
        * m4/libtool.m4, ltmain.in (darwin): Support IBM's xlc and xlc++.


--- orig/NEWS
+++ mod/NEWS
@@ -1,7 +1,6 @@
 NEWS - list of user-visible changes between releases of GNU Libtool
 
 New in 1.5b: 2004-??-??; CVS version 1.5a, Libtool team:
-* New support for IBM's xlc and xlc++ on Mac OS X.
 * The /^_?LT_[A-Z_]+$/ namespace is now reserved for Libtool's own macros.
   If you have any shell variables in this namespace they will need to be
   renamed.  If you have any macros in this namespace please rename them to
@@ -41,10 +40,13 @@
 * libltdl no longer loads shared libraries with global symbol resolution,
   this caused problems when the symbols were intended to be overriden further
   up the stack; it is also not recommended practice.
+* libltdl no longer uses lt_dlmalloc, lt_dlrealloc and lt_dlfree.  The symbols
+  are still exported for backwards compatibility.
 * make install now deletes preexisting $prefix/share/libtool before installing
   latest files.
 * Extracting symbols from an import library on cygwin and win32 now works.
 * Initial support for amigaos-ppc.
+* New support for IBM's xlc and xlc++ on Mac OS X.
 * Bug fixes.
 
 New in 1.5.2: 2004-01-25; CVS version 1.5.0a, Libtool team:


--- orig/config/config.guess
+++ mod/config/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-10-20'
+timestamp='2004-01-05'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1186,7 +1186,7 @@
     *:QNX:*:4*)
        echo i386-pc-qnx
        exit 0 ;;
-    NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
+    NSR-?:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
        exit 0 ;;
     *:NonStop-UX:*:*)


--- orig/config/config.sub
+++ mod/config/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-11-20'
+timestamp='2004-01-05'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -380,6 +380,9 @@
        amd64)
                basic_machine=x86_64-pc
                ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        amdahl)
                basic_machine=580-amdahl
                os=-sysv


--- orig/doc/libtool.texi
+++ mod/doc/libtool.texi
@@ -3184,22 +3184,6 @@
 @code{lt_dlerror}.
 @end deftypefun
 
address@hidden {lt_ptr (*) (size_t @var{size})} lt_dlmalloc
address@hidden {lt_ptr (*) (lt_ptr @var{ptr}, size_t @var{size})} lt_dlrealloc
address@hidden {void (*) (lt_ptr @var{ptr})} lt_dlfree
-These variables are set to @code{malloc}, @code{realloc} and @code{free} by
-default, but you can set them to any other functions that provide equivalent
-functionality.  If you change any of these function pointers, you will almost
-certainly need to change all three to point into the same malloc library.
-Strange things will happen if you allocate memory from one library, and then
-pass it to an implementation of @code{free} that doesn't know what book
-keeping the allocator used.
-
-You must not modify any of their values after calling any libltdl function
-other than @code{lt_dlpreopen_default} or the macro
address@hidden
address@hidden deftypevar
-
 @node Modules for libltdl
 @section Creating modules that can be @code{dlopen}ed
 


--- orig/libltdl/Makefile.am
+++ mod/libltdl/Makefile.am
@@ -17,16 +17,17 @@
 ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ## Boston, MA 02111-1307, USA.
 
-AUTOMAKE_OPTIONS = no-dependencies foreign
+AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS  = -I ../m4
 AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
 DEFS = -DHAVE_CONFIG_H="<$(CONFIG_H)>"
 
+pkgincludedir = $(includedir)/libltdl
+
 if INSTALL_LTDL
 include_HEADERS = ltdl.h
+pkginclude_HEADERS = lt_system.h
 lib_LTLIBRARIES = libltdl.la
-else
-noinst_HEADERS = ltdl.h
 endif
 
 if CONVENIENCE_LTDL
@@ -37,17 +38,13 @@
 ## default.
 CLEANFILES = libltdl.la libltdlc.la
 
-libltdl_la_SOURCES = ltdl.c ltdl.h
+libltdl_la_SOURCES = lt__alloc.c lt__alloc.h lt_system.h ltdl.c ltdl.h
 libltdl_la_LDFLAGS = -no-undefined -version-info 5:0:2
 libltdl_la_LIBADD = $(LIBADD_DL)
 
-libltdlc_la_SOURCES = ltdl.c ltdl.h
+libltdlc_la_SOURCES = $(libltdl_la_SOURCES)
 libltdlc_la_LIBADD = $(LIBADD_DL)
 
-## Because we do not have automatic dependency tracking:
-ltdl.lo: ltdl.h $(top_builddir)/$(CONFIG_H)
-
-
 ## These are installed as a subdirectory of pkgdatadir so that
 ## libtoolize --ltdl can find them later:
 ltdldatadir = $(pkgdatadir)/libltdl


--- orig/libltdl/ltdl.c
+++ mod/libltdl/ltdl.c
@@ -1,7 +1,9 @@
 /* ltdl.c -- system independent dlopen wrapper
-   Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
    Originally by Thomas Tanner <address@hidden>
-   This file is part of GNU Libtool.
+
+   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
@@ -37,16 +39,6 @@
 #  include <stdio.h>
 #endif
 
-/* Include the header defining malloc.  On K&R C compilers,
-   that's <malloc.h>, on ANSI C and ISO C compilers, that's <stdlib.h>.  */
-#if HAVE_STDLIB_H
-#  include <stdlib.h>
-#else
-#  if HAVE_MALLOC_H
-#    include <malloc.h>
-#  endif
-#endif
-
 #if HAVE_STRING_H
 #  include <string.h>
 #else
@@ -78,6 +70,7 @@
 #endif
 
 #include "ltdl.h"
+#include "lt__alloc.h"
 
 #if defined(HAVE_CLOSEDIR) && defined(HAVE_OPENDIR) && defined(HAVE_READDIR) 
&& defined(HAVE_DIRENT_H)
 /* We have a fully operational dirent subsystem.  */
@@ -120,14 +113,6 @@
 #  define LT_GLOBAL_DATA
 #endif
 
-/* fopen() mode flags for reading a text file */
-#undef LT_READTEXT_MODE
-#if defined(__WINDOWS__) || defined(__CYGWIN__)
-#  define LT_READTEXT_MODE "rt"
-#else
-#  define LT_READTEXT_MODE "r"
-#endif
-
 
 
 /* --- MANIFEST CONSTANTS --- */
@@ -157,83 +142,9 @@
 
 
 
-/* --- MEMORY HANDLING --- */
-
-
-/* These are the functions used internally.  In addition to making
-   use of the associated function pointers above, they also perform
-   error handling.  */
-static char   *lt_estrdup      LT_PARAMS((const char *str));
-static lt_ptr lt_emalloc       LT_PARAMS((size_t size));
-static lt_ptr lt_erealloc      LT_PARAMS((lt_ptr addr, size_t size));
-
-/* static lt_ptr rpl_realloc   LT_PARAMS((lt_ptr ptr, size_t size)); */
-#define rpl_realloc realloc
-
-/* These are the pointers that can be changed by the caller:  */
-LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc)   LT_PARAMS((size_t size))
-                       = (lt_ptr (*) LT_PARAMS((size_t))) malloc;
-LT_GLOBAL_DATA lt_ptr (*lt_dlrealloc)  LT_PARAMS((lt_ptr ptr, size_t size))
-                       = (lt_ptr (*) LT_PARAMS((lt_ptr, size_t))) rpl_realloc;
-LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PARAMS((lt_ptr ptr))
-                       = (void (*) LT_PARAMS((lt_ptr))) free;
-
-/* The following macros reduce the amount of typing needed to cast
-   assigned memory.  */
-#if WITH_DMALLOC
-
-#define LT_DLMALLOC(tp, n)     ((tp *) xmalloc ((n) * sizeof(tp)))
-#define LT_DLREALLOC(tp, p, n) ((tp *) xrealloc ((p), (n) * sizeof(tp)))
-#define LT_DLFREE(p)                                           \
-       LT_STMT_START { if (p) (p) = (xfree (p), (lt_ptr) 0); } LT_STMT_END
-
-#define LT_EMALLOC(tp, n)      ((tp *) xmalloc ((n) * sizeof(tp)))
-#define LT_EREALLOC(tp, p, n)  ((tp *) xrealloc ((p), (n) * sizeof(tp)))
-
-#else
-
-#define LT_DLMALLOC(tp, n)     ((tp *) lt_dlmalloc ((n) * sizeof(tp)))
-#define LT_DLREALLOC(tp, p, n) ((tp *) lt_dlrealloc ((p), (n) * sizeof(tp)))
-#define LT_DLFREE(p)                                           \
-       LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END
-
-#define LT_EMALLOC(tp, n)      ((tp *) lt_emalloc ((n) * sizeof(tp)))
-#define LT_EREALLOC(tp, p, n)  ((tp *) lt_erealloc ((p), (n) * sizeof(tp)))
-
-#endif
-
-#define LT_DLMEM_REASSIGN(p, q)                        LT_STMT_START { \
-       if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; }   \
-                                               } LT_STMT_END
-
-
 /* --- REPLACEMENT FUNCTIONS --- */
 
 
-#undef strdup
-#define strdup rpl_strdup
-
-static char *strdup LT_PARAMS((const char *str));
-
-static char *
-strdup(str)
-     const char *str;
-{
-  char *tmp = 0;
-
-  if (str)
-    {
-      tmp = LT_DLMALLOC (char, 1+ strlen (str));
-      if (tmp)
-       {
-         strcpy(tmp, str);
-       }
-    }
-
-  return tmp;
-}
-
-
 #if ! HAVE_STRCMP
 
 #undef strcmp
@@ -411,7 +322,7 @@
 {
   assert (entry != (DIR *) NULL);
   FindClose (entry->hSearch);
-  lt_dlfree ((lt_ptr) entry);
+  free ((lt_ptr) entry);
 }
 
 
@@ -427,24 +338,23 @@
   assert (path != (char *) NULL);
   (void) strncpy (file_specification, path, LT_FILENAME_MAX-1);
   (void) strcat (file_specification, "\\");
-  entry = LT_DLMALLOC (DIR, sizeof(DIR));
+  entry = (DIR *) malloc (sizeof(DIR));
   if (entry != (DIR *) 0)
     {
       entry->firsttime = TRUE;
       entry->hSearch = FindFirstFile (file_specification,
                                      &entry->Win32FindData);
-    }
 
-  if (entry->hSearch == INVALID_HANDLE_VALUE)
-    {
-      (void) strcat (file_specification, "\\*.*");
-      entry->hSearch = FindFirstFile (file_specification,
-                                     &entry->Win32FindData);
       if (entry->hSearch == INVALID_HANDLE_VALUE)
-        {
-          LT_DLFREE (entry);
-          return (DIR *) 0;
-        }
+       {
+         (void) strcat (file_specification, "\\*.*");
+         entry->hSearch = FindFirstFile (file_specification,
+                                         &entry->Win32FindData);
+         if (entry->hSearch == INVALID_HANDLE_VALUE)
+           {
+             entry = (free (entry), (DIR *) 0);
+           }
+       }
     }
 
   return entry;
@@ -479,61 +389,6 @@
 #endif /* !LT_USE_WINDOWS_DIRENT_EMULATION */
 
 
-/* According to Alexandre Oliva <address@hidden>,
-    ``realloc is not entirely portable''
-   In any case we want to use the allocator supplied by the user without
-   burdening them with an lt_dlrealloc function pointer to maintain.
-   Instead implement our own version (with known boundary conditions)
-   using lt_dlmalloc and lt_dlfree. */
-
-/* #undef realloc
-   #define realloc rpl_realloc
-*/
-#if 0
-  /* You can't (re)define realloc unless you also (re)define malloc.
-     Right now, this code uses the size of the *destination* to decide
-     how much to copy.  That's not right, but you can't know the size
-     of the source unless you know enough about, or wrote malloc.  So
-     this code is disabled... */
-
-static lt_ptr
-realloc (ptr, size)
-     lt_ptr ptr;
-     size_t size;
-{
-  if (size == 0)
-    {
-      /* For zero or less bytes, free the original memory */
-      if (ptr != 0)
-       {
-         lt_dlfree (ptr);
-       }
-
-      return (lt_ptr) 0;
-    }
-  else if (ptr == 0)
-    {
-      /* Allow reallocation of a NULL pointer.  */
-      return lt_dlmalloc (size);
-    }
-  else
-    {
-      /* Allocate a new block, copy and free the old block.  */
-      lt_ptr mem = lt_dlmalloc (size);
-
-      if (mem)
-       {
-         memcpy (mem, ptr, size);
-         lt_dlfree (ptr);
-       }
-
-      /* Note that the contents of PTR are not damaged if there is
-        insufficient memory to realloc.  */
-      return mem;
-    }
-}
-#endif
-
 
 #if ! HAVE_ARGZ_APPEND
 #  define argz_append rpl_argz_append
@@ -561,7 +416,7 @@
 
   /* Ensure there is enough room to append BUF_LEN.  */
   argz_len = *pargz_len + buf_len;
-  argz = LT_DLREALLOC (char, *pargz, argz_len);
+  argz = (char *) realloc (*pargz, argz_len);
   if (!argz)
     return ENOMEM;
 
@@ -599,13 +454,13 @@
 
   /* Make a copy of STR, but replacing each occurence of
      DELIM with '\0'.  */
-  argz_len = 1+ LT_STRLEN (str);
+  argz_len = 1+ strlen (str);
   if (argz_len)
     {
       const char *p;
       char *q;
 
-      argz = LT_DLMALLOC (char, argz_len);
+      argz = (char *) malloc (argz_len);
       if (!argz)
        return ENOMEM;
 
@@ -629,7 +484,7 @@
 
   /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory.  */
   if (!argz_len)
-    LT_DLFREE (argz);
+    argz = (free (argz), (char *) 0);
 
   /* Assign new values.  */
   *pargz = argz;
@@ -669,10 +524,10 @@
     --before;
 
   {
-    size_t entry_len   = 1+ LT_STRLEN (entry);
+    size_t entry_len   = 1+ strlen (entry);
     size_t argz_len    = *pargz_len + entry_len;
     size_t offset      = before - *pargz;
-    char   *argz       = LT_DLREALLOC (char, *pargz, argz_len);
+    char   *argz       = (char *) realloc (*pargz, argz_len);
 
     if (!argz)
       return ENOMEM;
@@ -845,7 +700,6 @@
 #endif
 
 
-
 
 /* --- MUTEX LOCKING --- */
 
@@ -941,7 +795,7 @@
   LT_DLMUTEX_LOCK ();
 
   errindex = errorcount - LT_ERROR_MAX;
-  temp = LT_EREALLOC (const char *, user_error_strings, 1 + errindex);
+  temp = REALLOC (const char *, user_error_strings, 1 + errindex);
   if (temp)
     {
       user_error_strings               = temp;
@@ -984,38 +838,6 @@
   return errors;
 }
 
-static lt_ptr
-lt_emalloc (size)
-     size_t size;
-{
-  lt_ptr mem = lt_dlmalloc (size);
-  if (size && !mem)
-    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
-  return mem;
-}
-
-static lt_ptr
-lt_erealloc (addr, size)
-     lt_ptr addr;
-     size_t size;
-{
-  lt_ptr mem = lt_dlrealloc (addr, size);
-  if (size && !mem)
-    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
-  return mem;
-}
-
-static char *
-lt_estrdup (str)
-     const char *str;
-{
-  char *copy = strdup (str);
-  if (LT_STRLEN (str) && !copy)
-    LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
-  return copy;
-}
-
-
 
 
 /* --- DLOPEN() INTERFACE LOADER --- */
@@ -1296,13 +1118,13 @@
   if (ext)
     {
       /* FILENAME already has an extension. */
-      searchname = lt_estrdup (filename);
+      searchname = lt__strdup (filename);
     }
   else
     {
       /* Append a `.' to stop Windows from adding an
         implicit `.dll' extension. */
-      searchname = LT_EMALLOC (char, 2+ LT_STRLEN (filename));
+      searchname = MALLOC (char, 2+ LT_STRLEN (filename));
       if (searchname)
        sprintf (searchname, "%s.", filename);
     }
@@ -1318,7 +1140,7 @@
 #else
   module = LoadLibrary (searchname);
 #endif
-  LT_DLFREE (searchname);
+  FREE (searchname);
 
   /* libltdl expects this function to fail if it is unable
      to physically load the library.  Sadly, LoadLibrary
@@ -1493,13 +1315,12 @@
      lt_user_data loader_data;
      const char *filename;
 {
-  lt_module module = strdup (filename);
+  lt_module module = lt__strdup (filename);
 
   if (dld_link (filename) != 0)
     {
       LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN));
-      LT_DLFREE (module);
-      module = 0;
+      FREE (module);
     }
 
   return module;
@@ -1519,7 +1340,7 @@
     }
   else
     {
-      LT_DLFREE (module);
+      FREE (module);
     }
 
   return errors;
@@ -1939,7 +1760,7 @@
       lt_dlsymlists_t  *tmp = lists;
 
       lists = lists->next;
-      LT_DLFREE (tmp);
+      FREE (tmp);
     }
   preloaded_symbols = 0;
 
@@ -1976,7 +1797,7 @@
       lists = lists->next;
     }
 
-  tmp = LT_EMALLOC (lt_dlsymlists_t, 1);
+  tmp = MALLOC (lt_dlsymlists_t, 1);
   if (tmp)
     {
       memset (tmp, 0, sizeof(lt_dlsymlists_t));
@@ -2123,8 +1944,6 @@
                                                 const char *dlname,
                                                 const char *old_name,
                                                 int installed));
-static int     free_vars             LT_PARAMS((char *dlname, char *oldname,
-                                                char *libdir, char *deplibs));
 static int     load_deplibs          LT_PARAMS((lt_dlhandle handle,
                                                 char *deplibs));
 static int     trim                  LT_PARAMS((char **dest,
@@ -2158,6 +1977,15 @@
 static lt_dlhandle     handles         = 0;
 static int             initialized     = 0;
 
+/* Our memory failure callback sets the error message to be passed back
+   up to the client, so we must be careful to return from mallocation
+   callers if allocation fails (as this callback returns!!).  */
+void
+lt__alloc_die_callback (void)
+{
+  LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY));
+}
+
 /* Initialize libltdl. */
 int
 lt_dlinit ()
@@ -2169,6 +1997,8 @@
   /* Initialize only at first call. */
   if (++initialized == 1)
     {
+      lt__alloc_die = lt__alloc_die_callback;
+
       handles = 0;
       user_search_path = 0; /* empty search path */
 
@@ -2312,7 +2142,7 @@
              ++errors;
            }
 
-         LT_DLMEM_REASSIGN (loader, next);
+         MEMREASSIGN (loader, next);
        }
       loaders = 0;
     }
@@ -2378,7 +2208,7 @@
          goto done;
        } */
 
-      cur->info.filename = lt_estrdup (filename);
+      cur->info.filename = lt__strdup (filename);
       if (!cur->info.filename)
        {
          ++errors;
@@ -2405,7 +2235,7 @@
 
   if (!loader)
     {
-      LT_DLFREE (cur->info.filename);
+      FREE (cur->info.filename);
       ++errors;
       goto done;
     }
@@ -2447,7 +2277,7 @@
 
   /* Allocate memory, and combine DIRNAME and MODULENAME into it.
      The PREFIX (if any) is handled below.  */
-  filename  = LT_EMALLOC (char, dirname_len + 1 + filename_len + 1);
+  filename  = MALLOC (char, dirname_len + 1 + filename_len + 1);
   if (!filename)
     return 1;
 
@@ -2466,7 +2296,7 @@
       ++error;
     }
 
-  LT_DLFREE (filename);
+  FREE (filename);
   return error;
 }
 
@@ -2527,7 +2357,7 @@
   assert (path && *path);
   assert (pcanonical);
 
-  canonical = LT_EMALLOC (char, 1+ LT_STRLEN (path));
+  canonical = MALLOC (char, 1+ LT_STRLEN (path));
   if (!canonical)
     return 1;
 
@@ -2652,9 +2482,9 @@
 
        if (lendir +1 +lenbase >= filenamesize)
        {
-         LT_DLFREE (filename);
+         FREE (filename);
          filenamesize  = lendir +1 +lenbase +1; /* "/d" + '/' + "f" + '\0' */
-         filename      = LT_EMALLOC (char, filenamesize);
+         filename      = MALLOC (char, filenamesize);
          if (!filename)
            goto cleanup;
        }
@@ -2677,9 +2507,9 @@
   }
 
  cleanup:
-  LT_DLFREE (argz);
-  LT_DLFREE (canonical);
-  LT_DLFREE (filename);
+  FREE (argz);
+  FREE (canonical);
+  FREE (filename);
 
   LT_DLMUTEX_UNLOCK ();
 
@@ -2710,8 +2540,8 @@
       if (dirend > filename)
        *dirend   = LT_EOS_CHAR;
 
-      LT_DLFREE (*pdir);
-      *pdir   = lt_estrdup (filename);
+      FREE (*pdir);
+      *pdir   = lt__strdup (filename);
       is_done = (*pdir == 0) ? -1 : 1;
     }
 
@@ -2795,7 +2625,7 @@
   LT_DLMUTEX_LOCK ();
   if (user_search_path)
     {
-      save_search_path = lt_estrdup (user_search_path);
+      save_search_path = lt__strdup (user_search_path);
       if (!save_search_path)
        goto cleanup;
     }
@@ -2836,8 +2666,7 @@
     }
 
   /* restore the old search path */
-  LT_DLFREE (user_search_path);
-  user_search_path = save_search_path;
+  MEMREASSIGN (user_search_path, save_search_path);
 
   LT_DLMUTEX_UNLOCK ();
 
@@ -2847,7 +2676,7 @@
       goto cleanup;
     }
 
-  names = LT_EMALLOC (char *, depcount * sizeof (char*));
+  names = MALLOC (char *, depcount);
   if (!names)
     goto cleanup;
 
@@ -2876,12 +2705,12 @@
              if (strncmp(p, "-l", 2) == 0)
                {
                  size_t name_len = 3+ /* "lib" */ LT_STRLEN (p + 2);
-                 name = LT_EMALLOC (char, 1+ name_len);
+                 name = MALLOC (char, 1+ name_len);
                  if (name)
                    sprintf (name, "lib%s", p+2);
                }
              else
-               name = lt_estrdup(p);
+               name = strdup(p);
 
              if (!name)
                goto cleanup_names;
@@ -2902,7 +2731,7 @@
     {
       int      j = 0;
 
-      handle->deplibs = (lt_dlhandle*) LT_EMALLOC (lt_dlhandle *, depcount);
+      handle->deplibs = (lt_dlhandle*) MALLOC (lt_dlhandle *, depcount);
       if (!handle->deplibs)
        goto cleanup;
 
@@ -2922,11 +2751,11 @@
  cleanup_names:
   for (i = 0; i < depcount; ++i)
     {
-      LT_DLFREE (names[i]);
+      FREE (names[i]);
     }
 
  cleanup:
-  LT_DLFREE (names);
+  FREE (names);
 #endif
 
   return errors;
@@ -2964,11 +2793,11 @@
   size_t len       = LT_STRLEN (str);
   char *tmp;
 
-  LT_DLFREE (*dest);
+  FREE (*dest);
 
   if (len > 3 && str[0] == '\'')
     {
-      tmp = LT_EMALLOC (char, end - str);
+      tmp = MALLOC (char, end - str);
       if (!tmp)
        return 1;
 
@@ -2985,21 +2814,6 @@
 }
 
 static int
-free_vars (dlname, oldname, libdir, deplibs)
-     char *dlname;
-     char *oldname;
-     char *libdir;
-     char *deplibs;
-{
-  LT_DLFREE (dlname);
-  LT_DLFREE (oldname);
-  LT_DLFREE (libdir);
-  LT_DLFREE (deplibs);
-
-  return 0;
-}
-
-static int
 try_dlopen (phandle, filename)
      lt_dlhandle *phandle;
      const char *filename;
@@ -3021,7 +2835,7 @@
   /* dlopen self? */
   if (!filename)
     {
-      *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1);
+      *phandle = (lt_dlhandle) MALLOC (struct lt_dlhandle_struct, 1);
       if (*phandle == 0)
        return 1;
 
@@ -3033,7 +2847,7 @@
 
       if (tryall_dlopen (&newhandle, 0) != 0)
        {
-         LT_DLFREE (*phandle);
+         FREE (*phandle);
          return 1;
        }
 
@@ -3057,7 +2871,7 @@
     {
       size_t dirlen = (1+ base_name) - canonical;
 
-      dir = LT_EMALLOC (char, 1+ dirlen);
+      dir = MALLOC (char, 1+ dirlen);
       if (!dir)
        {
          ++errors;
@@ -3070,7 +2884,7 @@
       ++base_name;
     }
   else
-    LT_DLMEM_REASSIGN (base_name, canonical);
+    MEMREASSIGN (base_name, canonical);
 
   assert (base_name && *base_name);
 
@@ -3093,7 +2907,7 @@
       int      installed = 1;
 
       /* extract the module name from the file name */
-      name = LT_EMALLOC (char, ext - base_name + 1);
+      name = MALLOC (char, ext - base_name + 1);
       if (!name)
        {
          ++errors;
@@ -3168,7 +2982,7 @@
        }
 
       line_len = LT_FILENAME_MAX;
-      line = LT_EMALLOC (char, line_len);
+      line = MALLOC (char, line_len);
       if (!line)
        {
          fclose (file);
@@ -3188,7 +3002,13 @@
             that is longer than the initial buffer size.  */
          while ((line[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
            {
-             line = LT_DLREALLOC (char, line, line_len *2);
+             line = REALLOC (char, line, line_len *2);
+             if (!line)
+               {
+                 fclose (file);
+                 ++errors;
+                 goto cleanup;
+               }
              if (!fgets (&line[line_len -1], (int) line_len +1, file))
                {
                  break;
@@ -3249,13 +3069,13 @@
                  && dlname
                  && (last_libname = strrchr (dlname, ' ')) != 0)
                {
-                 last_libname = lt_estrdup (last_libname + 1);
+                 last_libname = strdup (last_libname + 1);
                  if (!last_libname)
                    {
                      ++errors;
                      goto cleanup;
                    }
-                 LT_DLMEM_REASSIGN (dlname, last_libname);
+                 MEMREASSIGN (dlname, last_libname);
                }
            }
 
@@ -3264,17 +3084,20 @@
        }
 
       fclose (file);
-      LT_DLFREE (line);
+      FREE (line);
 
       /* allocate the handle */
-      *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1);
+      *phandle = (lt_dlhandle) malloc (sizeof (struct lt_dlhandle_struct));
       if (*phandle == 0)
        ++errors;
 
       if (errors)
        {
-         free_vars (dlname, old_name, libdir, deplibs);
-         LT_DLFREE (*phandle);
+         FREE (dlname);
+         FREE (old_name);
+         FREE (libdir);
+         FREE (deplibs);
+         FREE (*phandle);
          goto cleanup;
        }
 
@@ -3296,10 +3119,14 @@
          ++errors;
        }
 
-      free_vars (dlname, old_name, libdir, deplibs);
+      FREE (dlname);
+      FREE (old_name);
+      FREE (libdir);
+      FREE (deplibs);
+
       if (errors)
        {
-         LT_DLFREE (*phandle);
+         FREE (*phandle);
          goto cleanup;
        }
 
@@ -3311,7 +3138,7 @@
   else
     {
       /* not a libtool module */
-      *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1);
+      *phandle = (lt_dlhandle) MALLOC (struct lt_dlhandle_struct, 1);
       if (*phandle == 0)
        {
          ++errors;
@@ -3345,19 +3172,19 @@
 
       if (!newhandle)
        {
-         LT_DLFREE (*phandle);
+         FREE (*phandle);
          ++errors;
          goto cleanup;
        }
     }
 
  register_handle:
-  LT_DLMEM_REASSIGN (*phandle, newhandle);
+  MEMREASSIGN (*phandle, newhandle);
 
   if ((*phandle)->info.ref_count == 0)
     {
       (*phandle)->info.ref_count       = 1;
-      LT_DLMEM_REASSIGN ((*phandle)->info.name, name);
+      MEMREASSIGN ((*phandle)->info.name, name);
 
       LT_DLMUTEX_LOCK ();
       (*phandle)->next         = handles;
@@ -3368,9 +3195,9 @@
   LT_DLMUTEX_SETERROR (saved_error);
 
  cleanup:
-  LT_DLFREE (dir);
-  LT_DLFREE (name);
-  LT_DLFREE (canonical);
+  FREE (dir);
+  FREE (name);
+  FREE (canonical);
 
   return errors;
 }
@@ -3439,7 +3266,7 @@
     }
 
   /* First try appending ARCHIVE_EXT.  */
-  tmp = LT_EMALLOC (char, len + LT_STRLEN (archive_ext) + 1);
+  tmp = MALLOC (char, len + LT_STRLEN (archive_ext) + 1);
   if (!tmp)
     return 0;
 
@@ -3454,7 +3281,7 @@
      in the module search path.  */
   if (handle || ((errors > 0) && !file_not_found ()))
     {
-      LT_DLFREE (tmp);
+      FREE (tmp);
       return handle;
     }
 
@@ -3462,8 +3289,8 @@
   /* Try appending SHLIB_EXT.   */
   if (LT_STRLEN (shlib_ext) > LT_STRLEN (archive_ext))
     {
-      LT_DLFREE (tmp);
-      tmp = LT_EMALLOC (char, len + LT_STRLEN (shlib_ext) + 1);
+      FREE (tmp);
+      tmp = MALLOC (char, len + LT_STRLEN (shlib_ext) + 1);
       if (!tmp)
        return 0;
 
@@ -3481,7 +3308,7 @@
      with the current error message.  */
   if (handle || ((errors > 0) && !file_not_found ()))
     {
-      LT_DLFREE (tmp);
+      FREE (tmp);
       return handle;
     }
 #endif
@@ -3489,7 +3316,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_DLFREE (tmp);
+  FREE (tmp);
   return 0;
 }
 
@@ -3590,7 +3417,7 @@
   /* Prepend the directory name.  */
   end_offset   = end - dp->d_name;
   buf_len      = dir_len + 1+ end_offset;
-  buf          = LT_EMALLOC (char, 1+ buf_len);
+  buf          = MALLOC (char, 1+ buf_len);
   if (!buf)
     return ++errors;
 
@@ -3605,7 +3432,7 @@
   if (lt_argz_insertinorder (pargz, pargz_len, buf) != 0)
     ++errors;
 
-  LT_DLFREE (buf);
+  FREE (buf);
 
   return errors;
 }
@@ -3674,7 +3501,7 @@
   }
 
  cleanup:
-  LT_DLFREE (argz);
+  FREE (argz);
 
   return is_done;
 }
@@ -3778,11 +3605,11 @@
       errors += unload_deplibs(handle);
 
       /* It is up to the callers to free the data itself.  */
-      LT_DLFREE (handle->caller_data);
+      FREE (handle->caller_data);
 
-      LT_DLFREE (handle->info.filename);
-      LT_DLFREE (handle->info.name);
-      LT_DLFREE (handle);
+      FREE (handle->info.filename);
+      FREE (handle->info.name);
+      FREE (handle);
 
       goto done;
     }
@@ -3831,7 +3658,7 @@
     }
   else
     {
-      sym = LT_EMALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1);
+      sym = MALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1);
       if (!sym)
        {
          LT_DLMUTEX_SETERROR (LT_DLSTRERROR (BUFFER_OVERFLOW));
@@ -3866,7 +3693,7 @@
        {
          if (sym != lsym)
            {
-             LT_DLFREE (sym);
+             FREE (sym);
            }
          return address;
        }
@@ -3887,7 +3714,7 @@
   address = handle->loader->find_sym (data, handle->module, sym);
   if (sym != lsym)
     {
-      LT_DLFREE (sym);
+      FREE (sym);
     }
 
   return address;
@@ -3932,7 +3759,7 @@
       assert (!before);                /* BEFORE cannot be set without PPATH.  
*/
       assert (dir);            /* Without DIR, don't call this function!  */
 
-      *ppath = lt_estrdup (dir);
+      *ppath = strdup (dir);
       if (*ppath == 0)
        ++errors;
 
@@ -3967,11 +3794,11 @@
     }
 
   argz_stringify (argz, argz_len, LT_PATHSEP_CHAR);
-  LT_DLMEM_REASSIGN (*ppath,  argz);
+  MEMREASSIGN(*ppath, argz);
 
  cleanup:
-  LT_DLFREE (canonical);
-  LT_DLFREE (argz);
+  FREE (argz);
+  FREE (canonical);
 
   return errors;
 }
@@ -4034,7 +3861,7 @@
   int   errors     = 0;
 
   LT_DLMUTEX_LOCK ();
-  LT_DLFREE (user_search_path);
+  FREE (user_search_path);
   LT_DLMUTEX_UNLOCK ();
 
   if (!search_path || !LT_STRLEN (search_path))
@@ -4211,7 +4038,7 @@
   if (i == n_elements)
     {
       lt_caller_data *temp
-       = LT_DLREALLOC (lt_caller_data, handle->caller_data, 2+ n_elements);
+       = REALLOC (lt_caller_data, handle->caller_data, 2+ n_elements);
 
       if (!temp)
        {
@@ -4287,7 +4114,7 @@
     }
 
   /* Create a new dlloader node with copies of the user callbacks.  */
-  node = LT_EMALLOC (lt_dlloader, 1);
+  node = MALLOC (lt_dlloader, 1);
   if (!node)
     return 1;
 
@@ -4402,7 +4229,7 @@
       errors = place->dlloader_exit (place->dlloader_data);
     }
 
-  LT_DLFREE (place);
+  FREE (place);
 
  done:
   LT_DLMUTEX_UNLOCK ();
@@ -4481,3 +4308,12 @@
 
   return place;
 }
+
+
+
+
+/* These pointers are part of the published interface to libltdl,
+   although they are no longer used.  */
+LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc)   LT_PARAMS((size_t size)) = 0;
+LT_GLOBAL_DATA lt_ptr (*lt_dlrealloc)  LT_PARAMS((lt_ptr ptr, size_t size)) = 
0;
+LT_GLOBAL_DATA void   (*lt_dlfree)     LT_PARAMS((lt_ptr ptr)) = 0;


--- orig/libltdl/ltdl.h
+++ mod/libltdl/ltdl.h
@@ -1,7 +1,9 @@
 /* ltdl.h -- generic dlopen functions
    Copyright (C) 1998-2000 Free Software Foundation, Inc.
    Originally by Thomas Tanner <address@hidden>
-   This file is part of GNU Libtool.
+
+   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
@@ -28,58 +30,11 @@
 #ifndef LTDL_H
 #define LTDL_H 1
 
-#include <sys/types.h>         /* for size_t declaration */
-
-
-/* --- MACROS FOR PORTABILITY --- */
-
-
-/* Saves on those hard to debug '\0' typos....  */
-#define LT_EOS_CHAR    '\0'
-
-/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations,
-   so that C++ compilers don't mangle their names.  Use LTDL_END_C_DECLS at
-   the end of C declarations. */
-#ifdef __cplusplus
-# define LT_BEGIN_C_DECLS      extern "C" {
-# define LT_END_C_DECLS                }
-#else
-# define LT_BEGIN_C_DECLS      /* empty */
-# define LT_END_C_DECLS                /* empty */
-#endif
+#include <libltdl/lt_system.h>
 
 LT_BEGIN_C_DECLS
 
 
-/* Canonicalise Windows and Cygwin recognition macros.
-   To match the values set by recent Cygwin compilers, make sure that if
-   __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT!  */
-#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-#endif
-#if defined(__CYGWIN__)
-# if defined(__WINDOWS__)
-#   undef __WINDOWS__
-# endif
-#elif defined(_WIN32)
-# define __WINDOWS__ _WIN32
-#elif defined(WIN32)
-# define __WINDOWS__ WIN32
-#endif
-#if defined(__CYGWIN__) && defined(__WINDOWS__)
-# undef __WINDOWS__
-#endif
-
-
-#ifdef __WINDOWS__
-/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
-   separator when it is set. */
-# define LT_DIRSEP_CHAR                '\\'
-# define LT_PATHSEP_CHAR       ';'
-#else
-# define LT_PATHSEP_CHAR       ':'
-#endif
-
 /* DLL building support on win32 hosts;  mostly to workaround their
    ridiculous implementation of data symbol exporting. */
 #ifndef LT_SCOPE
@@ -97,11 +52,6 @@
 #endif
 
 
-#if defined(_MSC_VER) /* Visual Studio */
-#  define R_OK 4
-#endif
-
-
 /* LT_PARAMS is a macro used to wrap function prototypes, so that compilers
    that don't understand ANSI C prototypes still work, and ANSI C
    compilers can issue warnings about type mismatches.  */
@@ -113,28 +63,6 @@
 # define lt_ptr                char*
 #endif
 
-/* LT_STMT_START/END are used to create macros which expand to a
-   a single compound statement in a portable way.  */
-#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
-#  define LT_STMT_START        (void)(
-#  define LT_STMT_END          )
-#else
-#  if (defined (sun) || defined (__sun__))
-#    define LT_STMT_START      if (1)
-#    define LT_STMT_END        else (void)0
-#  else
-#    define LT_STMT_START      do
-#    define LT_STMT_END        while (0)
-#  endif
-#endif
-
-/* LT_CONC creates a new concatenated symbol for the compiler
-   in a portable way.  */
-#if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_VER)
-#  define LT_CONC(s,t) s##t
-#else
-#  define LT_CONC(s,t) s/**/t
-#endif
 
 /* LT_STRLEN can be used safely on NULL pointers.  */
 #define LT_STRLEN(s)   (((s) && (s)[0]) ? strlen (s) : 0)
@@ -192,21 +120,6 @@
 
 
 
-/* --- MEMORY HANDLING --- */
-
-
-/* By default, the realloc function pointer is set to our internal
-   realloc implementation which iself uses lt_dlmalloc and lt_dlfree.
-   libltdl relies on a featureful realloc, but if you are sure yours
-   has the right semantics then you can assign it directly.  Generally,
-   it is safe to assign just a malloc() and a free() function.  */
-LT_SCOPE  lt_ptr   (*lt_dlmalloc)      LT_PARAMS((size_t size));
-LT_SCOPE  lt_ptr   (*lt_dlrealloc)     LT_PARAMS((lt_ptr ptr, size_t size));
-LT_SCOPE  void    (*lt_dlfree)         LT_PARAMS((lt_ptr ptr));
-
-
-
-
 /* --- PRELOADED MODULE SUPPORT --- */
 
 
@@ -341,9 +254,16 @@
 LT_SCOPE       int     lt_dlseterror   LT_PARAMS((int errorcode));
 
 
+
+/* --- BINARY COMPATIBILITY WITH OLD LIBLTDL --- */
+
+LT_SCOPE  lt_ptr   (*lt_dlmalloc)      LT_PARAMS((size_t size));
+LT_SCOPE  lt_ptr   (*lt_dlrealloc)     LT_PARAMS((lt_ptr ptr, size_t size));
+LT_SCOPE  void    (*lt_dlfree)         LT_PARAMS((lt_ptr ptr));
+
 
 
-/* --- SOURCE COMPATIBILITY WITH OLD LIBLTDL --- */
+/* --- SOURCE COMPATIBILITY WITH ANCIENT LIBLTDL --- */
 
 
 #ifdef LT_NON_POSIX_NAMESPACE



* added files

--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt__alloc.c.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Thu Apr  1 13:32:54 2004 4677.0
--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt__alloc.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Thu Apr  1 13:32:54 2004 4677.1
--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/.arch-ids/lt_system.h.id
@@ -0,0 +1 @@
+Gary V. Vaughan <address@hidden> Thu Apr  1 13:32:54 2004 4677.2
--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/lt__alloc.c
@@ -0,0 +1,80 @@
+/* lt__alloc.c -- internal memory management interface
+   Copyright (C) 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
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#  include HAVE_CONFIG_H
+#endif
+
+#include <stdio.h>
+
+#include "lt__alloc.h"
+
+static void alloc_die_default (void);
+
+void (*lt__alloc_die) (void) = alloc_die_default;
+
+/* Unless overridden, exit on memory failure.  */
+static void
+alloc_die_default (void)
+{
+  fprintf (stderr, "Out of memory.\n");
+  exit (EXIT_FAILURE);
+}
+
+void *
+lt__malloc (size_t n)
+{
+  void *mem;
+
+  if (! (mem = malloc (n)))
+    (*lt__alloc_die) ();
+
+  return mem;
+}
+
+void *
+lt__realloc (void *mem, size_t n)
+{
+  if (! (mem = realloc (mem, n)))
+    (*lt__alloc_die) ();
+
+  return mem;
+}
+
+void *
+lt__memdup (void const *mem, size_t n)
+{
+  return memcpy (lt__malloc (n), mem, n);
+}
+
+char *
+lt__strdup (const char *string)
+{
+  return lt__memdup (string, strlen (string) +1);
+}
--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/lt__alloc.h
@@ -0,0 +1,56 @@
+/* lt__alloc.c -- internal memory management interface
+   Copyright (C) 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
+
+*/
+
+#ifndef LT__ALLOC_H
+#define LT__ALLOC_H 1
+
+#include "lt_system.h"
+
+LT_BEGIN_C_DECLS
+
+#define MALLOC(tp, n)          (tp*) lt__malloc((n) * sizeof(tp))
+#define REALLOC(tp, mem, n)    (tp*) lt__realloc((mem), (n) * sizeof(tp))
+#define FREE(mem)                                      LT_STMT_START { \
+       if (mem) (mem) = (free (mem), (void *) 0);      } LT_STMT_END
+#define MEMREASSIGN(p, q)                              LT_STMT_START { \
+       if ((p) != (q)) { if (p) free (p); (p) = (q); (q) = 0; }        \
+                                                       } LT_STMT_END
+
+/* If set, this function is called when memory allocation has failed.  */
+extern void (*lt__alloc_die) (void);
+
+void *lt__malloc (size_t n);
+void *lt__realloc (void *mem, size_t n);
+void *lt__memdup (void const *mem, size_t n);
+
+char *lt__strdup (const char *string);
+
+LT_END_C_DECLS
+
+#endif /*!LT__ALLOC_H*/
--- /dev/null
+++ 
/Users/gary/devel/savannah/libtool--devo--1.0/,,address@hidden/new-files-archive/./libltdl/lt_system.h
@@ -0,0 +1,123 @@
+/* lt_system.h -- system portability abstraction layer
+   Copyright (C) 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
+*/
+
+#ifndef LT_SYSTEM_H
+#define LT_SYSTEM_H 1
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+/* Some systems do not define EXIT_*, even with STDC_HEADERS.  */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+
+/* Saves on those hard to debug '\0' typos....  */
+#define LT_EOS_CHAR    '\0'
+
+/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations,
+   so that C++ compilers don't mangle their names.  Use LTDL_END_C_DECLS at
+   the end of C declarations. */
+#ifdef __cplusplus
+# define LT_BEGIN_C_DECLS      extern "C" {
+# define LT_END_C_DECLS                }
+#else
+# define LT_BEGIN_C_DECLS      /* empty */
+# define LT_END_C_DECLS                /* empty */
+#endif
+
+/* LT_STMT_START/END are used to create macros which expand to a
+   a single compound statement in a portable way.  */
+#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
+#  define LT_STMT_START        (void)(
+#  define LT_STMT_END          )
+#else
+#  if (defined (sun) || defined (__sun__))
+#    define LT_STMT_START      if (1)
+#    define LT_STMT_END        else (void)0
+#  else
+#    define LT_STMT_START      do
+#    define LT_STMT_END        while (0)
+#  endif
+#endif
+
+/* Canonicalise Windows and Cygwin recognition macros.
+   To match the values set by recent Cygwin compilers, make sure that if
+   __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT!  */
+#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
+# define __CYGWIN__ __CYGWIN32__
+#endif
+#if defined(__CYGWIN__)
+# if defined(__WINDOWS__)
+#   undef __WINDOWS__
+# endif
+#elif defined(_WIN32)
+# define __WINDOWS__ _WIN32
+#elif defined(WIN32)
+# define __WINDOWS__ WIN32
+#endif
+#if defined(__CYGWIN__) && defined(__WINDOWS__)
+# undef __WINDOWS__
+#endif
+
+
+#ifdef __WINDOWS__
+/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
+   separator when it is set. */
+# define LT_DIRSEP_CHAR                '\\'
+# define LT_PATHSEP_CHAR       ';'
+#else
+# define LT_PATHSEP_CHAR       ':'
+#endif
+
+#if defined(_MSC_VER) /* Visual Studio */
+#  define R_OK 4
+#endif
+
+/* fopen() mode flags for reading a text file */
+#undef LT_READTEXT_MODE
+#if defined(__WINDOWS__) || defined(__CYGWIN__)
+#  define LT_READTEXT_MODE "rt"
+#else
+#  define LT_READTEXT_MODE "r"
+#endif
+
+/* LT_CONC creates a new concatenated symbol for the compiler
+   in a portable way.  */
+#if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_VER)
+#  define LT_CONC(s,t) s##t
+#else
+#  define LT_CONC(s,t) s/**/t
+#endif
+
+#endif /*!LT__SYSTEM_H */


reply via email to

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