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>
+
+ * 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
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;
--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;
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;
while (symbol->name)
{
- if (strcmp (symbol->name, name) == 0)
+ if (streq (symbol->name, name))
{
return symbol->address;
}
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;
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)
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
}
if (cur->info.filename && filename
- && strcmp (cur->info.filename, filename) == 0)
+ && streq (cur->info.filename, filename))
{
break;
}
}
/* 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;
{
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;
}
/* 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
))
{
{
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));
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;
}
for (place = loaders; place; place = place->next)
{
- if (strcmp (place->loader_name, loader_name) == 0)
+ if (streq (place->loader_name, loader_name))
{
break;
}