]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.h (lt_dlrealloc): removed declaration.
authorGary V. Vaughan <gary@gnu.org>
Mon, 31 Jan 2000 10:40:12 +0000 (10:40 +0000)
committerGary V. Vaughan <gary@gnu.org>
Mon, 31 Jan 2000 10:40:12 +0000 (10:40 +0000)
* libltdl/ltdl.c (lt_dlrealloc): removed definition.
(lt_dladderror): Instead of calling lt_dlrealloc, use lt_dlmalloc,
and lt_dlfree.

ChangeLog
libltdl/ltdl.c
libltdl/ltdl.h

index 644682f6f0cb7de13b0e923a3d93cc6b2b0f301b..18bc8c9dcac3c073446205b79b190ab18ce57913 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2000-01-31  Gary V. Vaughan  <gary@oranda.demon.co.uk>
+
+       * libltdl/ltdl.h (lt_dlrealloc): removed declaration.
+       * libltdl/ltdl.c (lt_dlrealloc): removed definition.
+       (lt_dladderror): Instead of calling lt_dlrealloc, use lt_dlmalloc,
+       and lt_dlfree.
+
 2000-01-30  Ossama Othman  <ossama@debian.org>
 
        * libtool.m4 (lt_cv_cc_needs_belf): Set the test language to C
index db7e52edb25f0ca9c4ed8b7fafb264ad3f4c7666..cab64addf7193456bbbc8d04fb577145f49d80d1 100644 (file)
@@ -113,7 +113,6 @@ static const char *ltdl_error_strings[] = {
 static const char *last_error = 0;
 
 LTDL_GLOBAL_DATA lt_ptr_t (*lt_dlmalloc) LTDL_PARAMS((size_t size)) = (lt_ptr_t(*)LTDL_PARAMS((size_t)))malloc;
-LTDL_GLOBAL_DATA lt_ptr_t (*lt_dlrealloc) LTDL_PARAMS((lt_ptr_t ptr, size_t size)) = (lt_ptr_t(*)LTDL_PARAMS((lt_ptr_t, size_t)))realloc;
 LTDL_GLOBAL_DATA void   (*lt_dlfree)  LTDL_PARAMS((lt_ptr_t ptr)) = (void(*)LTDL_PARAMS((lt_ptr_t)))free;
 
 #define LTDL_TYPE_TOP 0
@@ -1882,20 +1881,23 @@ lt_dladderror (diagnostic)
        const char *diagnostic;
 {
        int index = errorcode - LTDL_ERROR_MAX;
-       
-       if (user_error_strings == 0)
-               user_error_strings = (const char **) lt_dlmalloc
-                       ((1+index) * sizeof(const char*));
-       else
-               user_error_strings = (const char **) lt_dlrealloc
-                       (user_error_strings, (1+index) * sizeof(const char*));
+       char **temp = 0;
 
-       if (user_error_strings == 0) {
+       /* realloc is not entirely portable, so simulate it using
+          lt_dlmalloc and lt_dlfree. */
+       temp = (const char **) lt_dlmalloc ((1+index) * sizeof(const char*));
+       if (temp == 0) {
                last_error = LT_DLSTRERROR(NO_MEMORY);
                return -1;
        }
-               
-       user_error_strings[index] = diagnostic;
+
+       /* Build the new vector in the memory addressed by temp. */
+       temp[index] = diagnostic;
+       while (--index >= 0)
+               temp[index] = user_error_strings[index];
+
+       lt_dlfree (user_error_strings);
+       user_error_strings = temp;
        return errorcode++;
 }
 
index dc043764cb3b96d55acebee66aabae5db484e25e..8a161e88a72fb8dfeb1948eff057894f5ca80425 100644 (file)
@@ -207,7 +207,6 @@ extern int lt_dlseterror LTDL_PARAMS((int errorcode));
                                                }LTDL_STMT_END
 
 LTDL_SCOPE lt_ptr_t (*lt_dlmalloc)LTDL_PARAMS((size_t size));
-LTDL_SCOPE lt_ptr_t (*lt_dlrealloc)LTDL_PARAMS((lt_ptr_t ptr, size_t size));
 LTDL_SCOPE void (*lt_dlfree)LTDL_PARAMS((lt_ptr_t ptr));
 
 __END_DECLS