From: Rusty Russell Date: Thu, 4 Nov 2010 10:22:42 +0000 (+1030) Subject: antithread, foreach, grab_file, hashtable, str_talloc: fix _info depends. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=776d740086ef279f35fb58a4b77b229f6dc1e332 antithread, foreach, grab_file, hashtable, str_talloc: fix _info depends. For str_talloc and grab_file, avoid using ccan/str (it's just for tests). --- diff --git a/ccan/antithread/_info b/ccan/antithread/_info index a32c8bc9..a6899c43 100644 --- a/ccan/antithread/_info +++ b/ccan/antithread/_info @@ -90,10 +90,11 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { - printf("ccan/talloc\n"); printf("ccan/alloc\n"); + printf("ccan/list\n"); printf("ccan/noerr\n"); printf("ccan/read_write_all\n"); /* For tests */ + printf("ccan/talloc\n"); return 0; } diff --git a/ccan/foreach/_info b/ccan/foreach/_info index a00ee8b3..c49a9525 100644 --- a/ccan/foreach/_info +++ b/ccan/foreach/_info @@ -63,6 +63,9 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { +#if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION + printf("ccan/list\n"); +#endif return 0; } diff --git a/ccan/foreach/foreach.c b/ccan/foreach/foreach.c index 07108b67..a18842b0 100644 --- a/ccan/foreach/foreach.c +++ b/ccan/foreach/foreach.c @@ -1,10 +1,10 @@ +#if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION #include #include #include #include #include -#if !HAVE_COMPOUND_LITERALS || !HAVE_FOR_LOOP_DECLARATION /* This list is normally very short. */ static LIST_HEAD(iters); diff --git a/ccan/grab_file/test/run-grab.c b/ccan/grab_file/test/run-grab.c index baaf5066..67be97c1 100644 --- a/ccan/grab_file/test/run-grab.c +++ b/ccan/grab_file/test/run-grab.c @@ -8,7 +8,6 @@ #include #include #include -#include int main(int argc, char *argv[]) @@ -21,10 +20,10 @@ main(int argc, char *argv[]) str = grab_file(NULL, "test/run-grab.c", NULL); split = strsplit(NULL, str, "\n", NULL); length = strlen(split[0]); - ok1(streq(split[0], "/* This is test for grab_file() function")); + ok1(!strcmp(split[0], "/* This is test for grab_file() function")); for (i = 1; split[i]; i++) length += strlen(split[i]); - ok1(streq(split[i-1], "/* End of grab_file() test */")); + ok1(!strcmp(split[i-1], "/* End of grab_file() test */")); if (stat("test/run-grab.c", &st) != 0) /* FIXME: ditto */ if (stat("ccan/grab_file/test/run-grab.c", &st) != 0) diff --git a/ccan/hashtable/_info b/ccan/hashtable/_info index c3c5b985..0974c155 100644 --- a/ccan/hashtable/_info +++ b/ccan/hashtable/_info @@ -1,4 +1,5 @@ #include +#include /** * hashtable - hash table routines @@ -110,6 +111,7 @@ int main(int argc, char *argv[]) return 1; if (strcmp(argv[1], "depends") == 0) { + printf("ccan/typesafe_cb\n"); return 0; } diff --git a/ccan/str_talloc/test/run.c b/ccan/str_talloc/test/run.c index 4e1c3d16..c8cc6217 100644 --- a/ccan/str_talloc/test/run.c +++ b/ccan/str_talloc/test/run.c @@ -3,7 +3,6 @@ #include #include #include -#include /* FIXME: ccanize */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) @@ -19,25 +18,25 @@ int main(int argc, char *argv[]) plan_tests(19); split = strsplit(NULL, "hello world", " ", &n); ok1(n == 3); - ok1(streq(split[0], "hello")); - ok1(streq(split[1], "")); - ok1(streq(split[2], "world")); + ok1(!strcmp(split[0], "hello")); + ok1(!strcmp(split[1], "")); + ok1(!strcmp(split[2], "world")); ok1(split[3] == NULL); talloc_free(split); split = strsplit(NULL, "hello world", " ", NULL); - ok1(streq(split[0], "hello")); - ok1(streq(split[1], "")); - ok1(streq(split[2], "world")); + ok1(!strcmp(split[0], "hello")); + ok1(!strcmp(split[1], "")); + ok1(!strcmp(split[2], "world")); ok1(split[3] == NULL); talloc_free(split); split = strsplit(NULL, "hello world", "o ", NULL); - ok1(streq(split[0], "hell")); - ok1(streq(split[1], "")); - ok1(streq(split[2], "")); - ok1(streq(split[3], "w")); - ok1(streq(split[4], "rld")); + ok1(!strcmp(split[0], "hell")); + ok1(!strcmp(split[1], "")); + ok1(!strcmp(split[2], "")); + ok1(!strcmp(split[3], "w")); + ok1(!strcmp(split[4], "rld")); ok1(split[5] == NULL); ctx = split; @@ -46,10 +45,10 @@ int main(int argc, char *argv[]) talloc_free(ctx); str = strjoin(NULL, substrings, ", "); - ok1(streq(str, "far, bar, baz, b, ba, z, ar, ")); + ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar, ")); ctx = str; str = strjoin(ctx, substrings, ""); - ok1(streq(str, "farbarbazbbazar")); + ok1(!strcmp(str, "farbarbazbbazar")); ok1(talloc_parent(str) == ctx); talloc_free(ctx);