]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller
authorEric Blake <ebb9@byu.net>
Wed, 5 Sep 2007 14:48:54 +0000 (14:48 +0000)
committerEric Blake <ebb9@byu.net>
Wed, 5 Sep 2007 14:48:54 +0000 (14:48 +0000)
has set data.

ChangeLog
libltdl/ltdl.c

index 0811fdf1644f9b6f5a9d78950fa1359ff41afd04..8e85e4ff418de73b102268df991720c2483c4b0a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-05  Eric Blake  <ebb9@byu.net>
+
+       * libltdl/ltdl.c (lt_dlcaller_get_data): Work even when no caller
+       has set data.
+
 2007-09-04  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * doc/libtool.texi (User defined module data)
index cfc61004b5cb1328d262ff0362d55d56c1660044..10716a8945d6c3adc532f781ea35832d99559f2b 100644 (file)
@@ -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;
 }