diff options
author | Gary V. Vaughan <gary@gnu.org> | 2011-10-24 21:36:27 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2011-11-17 19:21:10 +0700 |
commit | 2c0e68f058ebc36df0f581ab1232ac702f7e5a7a (patch) | |
tree | 38fdcf056579e50b8be4c5d1a13cb09dbe1c3ac1 /tests/slist.at | |
parent | 176ed6112974a072dfb0ff430fb6c2d9caf1f634 (diff) | |
download | libtool-2c0e68f058ebc36df0f581ab1232ac702f7e5a7a.tar.gz |
syntax-check: fix violations and re-enable sc_prohibit_strcmp.
* cfg.mk (local-checks-to-fix): Remove sc_prohibit_strcmp
from list of disabled checks.
(exclude_file_name_regexp--sc_prohibit_strcmp): Ignore
violations in libtool.texi and any demo C files.
* libltdl/libltdl/lt__private.h (strneq, streq): Renamed from
this...
(STRNEQ, STREQ): ..to this. Adjust all callers.
* tests/slist.at: Add STREQ definition. Change all !strcmp calls
to STREQ.
* build-aux/ltmain.m4sh (func_emit_cwrapperexe_src): Add and use
STREQ definition.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
Diffstat (limited to 'tests/slist.at')
-rw-r--r-- | tests/slist.at | 18 |
1 files changed, 10 insertions, 8 deletions
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; |