From: Gary V. Vaughan Date: Mon, 31 Jan 2000 10:40:12 +0000 (+0000) Subject: * libltdl/ltdl.h (lt_dlrealloc): removed declaration. X-Git-Tag: release-1-3d~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1f56497a1b71590bf4e49291663dc61cbde00f;p=thirdparty%2Flibtool.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 644682f6f..18bc8c9dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-01-31 Gary V. Vaughan + + * 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 * libtool.m4 (lt_cv_cc_needs_belf): Set the test language to C diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index db7e52edb..cab64addf 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -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++; } diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index dc043764c..8a161e88a 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -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