From: Eric Blake Date: Wed, 5 Sep 2007 14:48:54 +0000 (+0000) Subject: * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller X-Git-Tag: release-2-1b~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22204a9ff8efd4f6f55a736a8f2bbcf05829d1e0;p=thirdparty%2Flibtool.git * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller has set data. --- diff --git a/ChangeLog b/ChangeLog index 0811fdf16..8e85e4ff4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-05 Eric Blake + + * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller + has set data. + 2007-09-04 Ralf Wildenhues * doc/libtool.texi (User defined module data) diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index cfc61004b..10716a894 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -1035,7 +1035,7 @@ parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs, /* Handle the case where we occasionally need to read a line that is longer than the initial buffer size. - Behave even if the file contains NUL bytes due to corruption. */ + Behave even if the file contains NUL bytes due to corruption. */ while (line[line_len-2] != '\0' && line[line_len-2] != '\n' && !feof (file)) { line = REALLOC (char, line, line_len *2); @@ -2290,23 +2290,24 @@ lt_dlcaller_set_data (lt_dlinterface_id key, lt_dlhandle handle, void *data) } void * -lt_dlcaller_get_data (lt_dlinterface_id key, lt_dlhandle handle) +lt_dlcaller_get_data (lt_dlinterface_id key, lt_dlhandle handle) { void *result = (void *) 0; lt__handle *cur = (lt__handle *) handle; /* Locate the index of the element with a matching KEY. */ - { - int i; - for (i = 0; cur->interface_data[i].key; ++i) - { - if (cur->interface_data[i].key == key) - { - result = cur->interface_data[i].data; - break; - } - } - } + if (cur->interface_data) + { + int i; + for (i = 0; cur->interface_data[i].key; ++i) + { + if (cur->interface_data[i].key == key) + { + result = cur->interface_data[i].data; + break; + } + } + } return result; }