diff options
-rw-r--r-- | build-aux/ltmain.m4sh | 10 | ||||
-rw-r--r-- | cfg.mk | 3 | ||||
-rw-r--r-- | libltdl/libgnu/.gitignore | 2 | ||||
-rw-r--r-- | libltdl/libltdl/lt__private.h | 4 | ||||
-rw-r--r-- | libltdl/loaders/preopen.c | 10 | ||||
-rw-r--r-- | libltdl/lt_dlloader.c | 2 | ||||
-rw-r--r-- | libltdl/ltdl.c | 16 | ||||
-rw-r--r-- | tests/slist.at | 18 |
8 files changed, 34 insertions, 31 deletions
diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh index a6615833..54fbca49 100644 --- a/build-aux/ltmain.m4sh +++ b/build-aux/ltmain.m4sh @@ -3424,6 +3424,8 @@ EOF #include <fcntl.h> #include <sys/stat.h> +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ @@ -3620,7 +3622,7 @@ main (int argc, char *argv[]) newargc=0; for (i = 1; i < argc; i++) { - if (strcmp (argv[i], dumpscript_opt) == 0) + if (STREQ (argv[i], dumpscript_opt)) { EOF case "$host" in @@ -3634,12 +3636,12 @@ EOF lt_dump_script (stdout); return 0; } - if (strcmp (argv[i], debug_opt) == 0) + if (STREQ (argv[i], debug_opt)) { lt_debug = 1; continue; } - if (strcmp (argv[i], ltwrapper_option_prefix) == 0) + if (STREQ (argv[i], ltwrapper_option_prefix)) { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and @@ -4047,7 +4049,7 @@ strendzap (char *str, const char *pat) if (patlen <= len) { str += len - patlen; - if (strcmp (str, pat) == 0) + if (STREQ (str, pat)) *str = '\0'; } return str; @@ -40,7 +40,6 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = ^mail/ local-checks-to-fix = \ sc_prohibit_always-defined_macros \ sc_prohibit_always_true_header_tests \ - sc_prohibit_strcmp \ sc_prohibit_test_minus_ao \ sc_prohibit_undesirable_word_seq \ sc_require_config_h \ @@ -67,3 +66,5 @@ local-checks-to-skip = \ # List syntax-check exempted files. exclude_file_name_regexp--sc_error_message_uppercase = \ ^$(_build-aux)/cvsu$$ +exclude_file_name_regexp--sc_prohibit_strcmp = \ + ^(doc/libtool.texi|tests/.*demo/.*\.c)$$ diff --git a/libltdl/libgnu/.gitignore b/libltdl/libgnu/.gitignore deleted file mode 100644 index d9f53942..00000000 --- a/libltdl/libgnu/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile.am -/dummy.c diff --git a/libltdl/libltdl/lt__private.h b/libltdl/libltdl/lt__private.h index f4c4a3d7..3b2609bc 100644 --- a/libltdl/libltdl/lt__private.h +++ b/libltdl/libltdl/lt__private.h @@ -94,8 +94,8 @@ LT_SCOPE void lt__alloc_die_callback (void); /* For readability: */ -#define strneq(s1, s2) (strcmp((s1), (s2)) != 0) -#define streq(s1, s2) (!strcmp((s1), (s2))) +#define STRNEQ(s1, s2) (strcmp((s1), (s2)) != 0) +#define STREQ(s1, s2) (strcmp((s1), (s2)) == 0) diff --git a/libltdl/loaders/preopen.c b/libltdl/loaders/preopen.c index 7149287d..1fe41271 100644 --- a/libltdl/loaders/preopen.c +++ b/libltdl/loaders/preopen.c @@ -168,7 +168,7 @@ vm_open (lt_user_data LT__UNUSED loader_data, const char *filename, const lt_dlsymlist *symbol; for (symbol= lists->symlist; symbol->name; ++symbol) { - if (!symbol->address && streq (symbol->name, filename)) + if (!symbol->address && STREQ (symbol->name, filename)) { /* If the next symbol's name and address is 0, it means the module just contains the originator and no symbols. @@ -214,7 +214,7 @@ vm_sym (lt_user_data LT__UNUSED loader_data, lt_module module, const char *name) while (symbol->name) { - if (streq (symbol->name, name)) + if (STREQ (symbol->name, name)) { return symbol->address; } @@ -336,8 +336,8 @@ 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 ((originator && streq (list->symlist->name, originator)) - || (!originator && streq (list->symlist->name, "@PROGRAM@"))) + if ((originator && STREQ (list->symlist->name, originator)) + || (!originator && STREQ (list->symlist->name, "@PROGRAM@"))) { const lt_dlsymlist *symbol; unsigned int idx = 0; @@ -349,7 +349,7 @@ lt_dlpreload_open (const char *originator, lt_dlpreload_callback_func *func) while ((symbol = &list->symlist[++idx])->name != 0) { if ((symbol->address == 0) - && (strneq (symbol->name, "@PROGRAM@"))) + && (STRNEQ (symbol->name, "@PROGRAM@"))) { lt_dlhandle handle = lt_dlopen (symbol->name); if (handle == 0) diff --git a/libltdl/lt_dlloader.c b/libltdl/lt_dlloader.c index 2c99a22d..699a5042 100644 --- a/libltdl/lt_dlloader.c +++ b/libltdl/lt_dlloader.c @@ -52,7 +52,7 @@ loader_callback (SList *item, void *userdata) assert (vtable); - return streq (vtable->name, name) ? (void *) item : NULL; + return STREQ (vtable->name, name) ? (void *) item : NULL; } diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 06f0f5ae..0887734a 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -385,7 +385,7 @@ tryall_dlopen (lt_dlhandle *phandle, const char *filename, { if ((handle->info.filename == filename) /* dlopen self: 0 == 0 */ || (handle->info.filename && filename - && streq (handle->info.filename, filename))) + && STREQ (handle->info.filename, filename))) { break; } @@ -1108,11 +1108,11 @@ parse_dotla_file(FILE *file, char **dlname, char **libdir, char **deplibs, { errors += trim (deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]); } - else if (streq (line, "installed=yes\n")) + else if (STREQ (line, "installed=yes\n")) { *installed = 1; } - else if (streq (line, "installed=no\n")) + else if (STREQ (line, "installed=no\n")) { *installed = 0; } @@ -1324,7 +1324,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, const char *ext, } /* Check whether we are opening a libtool module (.la extension). */ - if (ext && streq (ext, archive_ext)) + if (ext && STREQ (ext, archive_ext)) { /* this seems to be a libtool module */ FILE * file = 0; @@ -1538,12 +1538,12 @@ has_library_ext (const char *filename) ext = strrchr (filename, '.'); - if (ext && ((streq (ext, archive_ext)) + if (ext && ((STREQ (ext, archive_ext)) #if defined(LT_MODULE_EXT) - || (streq (ext, shlib_ext)) + || (STREQ (ext, shlib_ext)) #endif #if defined(LT_SHARED_EXT) - || (streq (ext, shared_ext)) + || (STREQ (ext, shared_ext)) #endif )) { @@ -2428,7 +2428,7 @@ lt_dlhandle_fetch (lt_dlinterface_id iface, const char *module_name) while ((handle = lt_dlhandle_iterate (iface, handle))) { lt_dlhandle cur = handle; - if (cur && cur->info.name && streq (cur->info.name, module_name)) + if (cur && cur->info.name && STREQ (cur->info.name, module_name)) break; } diff --git a/tests/slist.at b/tests/slist.at index 741410c4..68907e63 100644 --- a/tests/slist.at +++ b/tests/slist.at @@ -31,9 +31,11 @@ AT_DATA([test-slist.c], [[ #include <stdio.h> #include "slist.h" +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + void *find_string (SList *item, void *data) { - if (data != NULL && !strcmp ((const char *) item->userdata, (const char *)data)) + if (data != NULL && STREQ ((const char *) item->userdata, (const char *)data)) return item; else return NULL; @@ -83,10 +85,10 @@ int main () assert (slist_find (list, find_string, (void *) "foo10") == NULL); item = (SList *) slist_find (list, find_string, (void *) "foo1"); assert (item != NULL); - assert (!strcmp ((const char *) item->userdata, "foo1")); + assert (STREQ ((const char *) item->userdata, "foo1")); item = slist_nth (list, 10); - assert (item != NULL && !strcmp ((const char *) item->userdata, "foo0")); + assert (item != NULL && STREQ ((const char *) item->userdata, "foo0")); puts ("list as inserted:"); slist_foreach (list, print_item, NULL); @@ -95,13 +97,13 @@ int main () slist_foreach (list, print_item, NULL); item = slist_nth (list, 1); - assert (item != NULL && !strcmp ((const char *) item->userdata, "foo0")); + assert (item != NULL && STREQ ((const char *) item->userdata, "foo0")); assert (10 == slist_length (list)); /* slist_tail is the second item, not the last one */ item = slist_tail (list); - assert (item != NULL && !strcmp ((const char *) item->userdata, "foo1")); + assert (item != NULL && STREQ ((const char *) item->userdata, "foo1")); assert (slist_tail (slist_nth (list, 10)) == NULL); @@ -131,19 +133,19 @@ int main () list_save = list; item = slist_remove (&list, find_string, (void *) "foo5"); assert (list_save == list); - assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo5")); + assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo5")); free (data); list_save = list; item = slist_remove (&list, find_string, (void *) "foo9"); assert (list_save == list); - assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo9")); + assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo9")); free (data); list_save = list; item = slist_remove (&list, find_string, (void *) "foo0"); assert (list_save != list); - assert (item != NULL && !strcmp (data = (char *) slist_unbox (item), "foo0")); + assert (item != NULL && STREQ (data = (char *) slist_unbox (item), "foo0")); free (data); list_save = list; |