]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/lt__private.h (streq, strneq): New macros to make strcmp
authorGary V. Vaughan <gary@gnu.org>
Thu, 15 Jul 2004 12:20:15 +0000 (12:20 +0000)
committerGary V. Vaughan <gary@gnu.org>
Thu, 15 Jul 2004 12:20:15 +0000 (12:20 +0000)
calls as used for simple comparison easier to read.
* libltdl/loaders/dyld.c, libltdl/loaders/preopen.c,
libltdl/ltdl.c: Use them!

ChangeLog
libltdl/loaders/dyld.c
libltdl/loaders/preopen.c
libltdl/lt__private.h
libltdl/ltdl.c

index 7d4d726f67c071f48374e0b2d0849cbff9728057..3e5080d9c8d359a1613c086c080766359af11232 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-07-15  Gary V. Vaughan  <gary@gnu.org>
+
+       * libltdl/lt__private.h (streq, strneq): New macros to make strcmp
+       calls as used for simple comparison easier to read.
+       * libltdl/loaders/dyld.c, libltdl/loaders/preopen.c,
+       libltdl/ltdl.c: Use them!
+
 2004-07-15  Gary V. Vaughan  <gary@gnu.org>
 
        This pervasive changeset makes two intertwined deep changes to the
index 1e5852f524b14b0b4930b9fdd7813f5d2bb784e7..bd112d427fc3fc03419569d329e8f05411a8e580 100644 (file)
@@ -390,7 +390,7 @@ lt__nsmodule_get_header (NSModule module)
   while (i > 0)
     {
       --i;
-      if (strcmp (_dyld_get_image_name (i), modname) != 0)
+      if (strneq (_dyld_get_image_name (i), modname))
        {
          mh = _dyld_get_image_header (i);
          break;
@@ -439,7 +439,7 @@ lt__match_loadedlib (const char *name)
 
       --i;
       id = lt__header_get_instnam (_dyld_get_image_header (i));
-      if (id && (strcmp (id, name) != 0))
+      if (id && strneq (id, name))
        {
          mh = _dyld_get_image_header (i);
          break;
index c570a7366e9e34c9eeef67e9cfbf02c2f8da5655..d9483804cc39b1747e5dde10c9ce58b532a298dd 100644 (file)
@@ -161,7 +161,7 @@ vm_open (lt_user_data loader_data, const char *filename)
       const lt_dlsymbol *symbol;
       for (symbol= lists->symlist->symbols; symbol->name; ++symbol)
        {
-         if (!symbol->address && strcmp(symbol->name, filename) == 0)
+         if (!symbol->address && streq (symbol->name, filename))
            {
              module = (lt_module) lists->symlist;
              goto done;
@@ -199,7 +199,7 @@ vm_sym (lt_user_data loader_data, lt_module module, const char *name)
 
   while (symbol->name)
     {
-      if (strcmp (symbol->name, name) == 0)
+      if (streq (symbol->name, name))
        {
          return symbol->address;
        }
@@ -320,7 +320,7 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func)
   for (list = preloaded_symlists; list; list = list->next)
     {
       /* ...that was preloaded by the requesting ORIGINATOR... */
-      if (strcmp (list->symlist->originator, originator) == 0)
+      if (streq (list->symlist->originator, originator))
        {
          const lt_dlsymbol *symbol;
          unsigned int idx = 0;
@@ -331,7 +331,7 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func)
          while ((symbol = &list->symlist->symbols[idx++])->name != 0)
            {
              if ((symbol->address == 0)
-                 && (strcmp (symbol->name, "@PROGRAM@") != 0))
+                 && (strneq (symbol->name, "@PROGRAM@")))
                {
                  lt_dlhandle handle = lt_dlopen (symbol->name);
                  if (handle == 0)
index 888ca927f77a1baf0a73069e044946af7916ffc6..bf258dbaa41acdfb5feff09f76bc32e24c87aada 100644 (file)
@@ -82,6 +82,12 @@ extern int errno;
 void lt__alloc_die_callback (void);
 
 
+/* For readability:  */
+#define strneq(s1, s2) (strcmp((s1), (s2)) != 0)
+#define streq(s1, s2)  (!strcmp((s1), (s2)))
+
+
+
 /* --- ERROR HANDLING --- */
 
 /* Extract the diagnostic strings from the error table macro in the same
index b11a9d059a3382179eb6d9c9c76edd91afe2553c..ff00782cd9a2a379a8e029c69cf3f5afddfef8c2 100644 (file)
@@ -368,7 +368,7 @@ tryall_dlopen (lt_dlhandle *handle, const char *filename)
        }
 
       if (cur->info.filename && filename
-         && strcmp (cur->info.filename, filename) == 0)
+         && streq (cur->info.filename, filename))
        {
          break;
        }
@@ -1062,7 +1062,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename)
       }
 
   /* Check whether we are opening a libtool module (.la extension).  */
-  if (ext && strcmp (ext, archive_ext) == 0)
+  if (ext && streq (ext, archive_ext))
     {
       /* this seems to be a libtool module */
       FILE *   file     = 0;
@@ -1195,11 +1195,11 @@ try_dlopen (lt_dlhandle *phandle, const char *filename)
            {
              errors += trim (&deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]);
            }
-         else if (strcmp (line, "installed=yes\n") == 0)
+         else if (streq (line, "installed=yes\n"))
            {
              installed = 1;
            }
-         else if (strcmp (line, "installed=no\n") == 0)
+         else if (streq (line, "installed=no\n"))
            {
              installed = 0;
            }
@@ -1398,9 +1398,9 @@ lt_dlopenext (const char *filename)
 
   /* If FILENAME already bears a suitable extension, there is no need
      to try appending additional extensions.  */
-  if (ext && ((strcmp (ext, archive_ext) == 0)
+  if (ext && ((streq (ext, archive_ext))
 #if defined(LTDL_SHLIB_EXT)
-             || (strcmp (ext, shlib_ext) == 0)
+             || (streq (ext, shlib_ext))
 #endif
       ))
     {
@@ -2050,7 +2050,7 @@ lt_dlhandle_find (const char *module_name)
     {
       do
        {
-         if (cur->info.name && strcmp (cur->info.name, module_name) == 0)
+         if (cur->info.name && streq (cur->info.name, module_name))
            break;
        }
       while ((cur = cur->next));
@@ -2250,7 +2250,7 @@ lt_dlloader_remove (const char *loader_name)
       lt_dlloader *prev;
       for (prev = loaders; prev->next; prev = prev->next)
        {
-         if (!strcmp (prev->next->loader_name, loader_name))
+         if (streq (prev->next->loader_name, loader_name))
            {
              break;
            }
@@ -2317,7 +2317,7 @@ lt_dlloader_find (const char *loader_name)
 
   for (place = loaders; place; place = place->next)
     {
-      if (strcmp (place->loader_name, loader_name) == 0)
+      if (streq (place->loader_name, loader_name))
        {
          break;
        }