From 4aaaaadeaef86cd6ab144ea8f5acf7f17ae45952 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sat, 26 Apr 2014 23:42:37 +1000 Subject: [PATCH] silence warnings --- bin/tests/sock_test.c | 13 +++++++---- bin/tests/task_test.c | 49 ++++++++++++++++++++++++------------------ bin/tests/timer_test.c | 16 ++++++++------ 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/bin/tests/sock_test.c b/bin/tests/sock_test.c index 02406b18ac..57c390697a 100644 --- a/bin/tests/sock_test.c +++ b/bin/tests/sock_test.c @@ -247,6 +247,11 @@ timeout(isc_task_t *task, isc_event_t *event) { isc_event_free(&event); } +static char one[] = "1"; +static char two[] = "2"; +static char xso1[] = "so1"; +static char xso2[] = "so2"; + int main(int argc, char *argv[]) { isc_task_t *t1, *t2; @@ -301,9 +306,9 @@ main(int argc, char *argv[]) { RUNTIME_CHECK(isc_task_create(manager, 0, &t1) == ISC_R_SUCCESS); t2 = NULL; RUNTIME_CHECK(isc_task_create(manager, 0, &t2) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, "1") == + RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, one) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, "2") == + RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, two) == ISC_R_SUCCESS); printf("task 1 = %p\n", t1); @@ -333,7 +338,7 @@ main(int argc, char *argv[]) { /* * Queue up the first accept event. */ - RUNTIME_CHECK(isc_socket_accept(so1, t1, my_listen, "so1") + RUNTIME_CHECK(isc_socket_accept(so1, t1, my_listen, xso1) == ISC_R_SUCCESS); isc_time_settoepoch(&expires); isc_interval_set(&interval, 10, 0); @@ -357,7 +362,7 @@ main(int argc, char *argv[]) { &so2) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_socket_connect(so2, &sockaddr, t2, - my_connect, "so2") == ISC_R_SUCCESS); + my_connect, xso2) == ISC_R_SUCCESS); /* * Detaching these is safe, since the socket will attach to the diff --git a/bin/tests/task_test.c b/bin/tests/task_test.c index 49ccd9de36..24c06caa25 100644 --- a/bin/tests/task_test.c +++ b/bin/tests/task_test.c @@ -58,6 +58,13 @@ my_tick(isc_task_t *task, isc_event_t *event) { isc_event_free(&event); } +static char one[] = "1"; +static char two[] = "2"; +static char three[] = "3"; +static char four[] = "4"; +static char foo[] = "foo"; +static char bar[] = "bar"; + int main(int argc, char *argv[]) { isc_taskmgr_t *manager = NULL; @@ -89,13 +96,13 @@ main(int argc, char *argv[]) { RUNTIME_CHECK(isc_task_create(manager, 0, &t3) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_task_create(manager, 0, &t4) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, "1") == + RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, one) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, "2") == + RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, two) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t3, my_shutdown, "3") == + RUNTIME_CHECK(isc_task_onshutdown(t3, my_shutdown, three) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t4, my_shutdown, "4") == + RUNTIME_CHECK(isc_task_onshutdown(t4, my_shutdown, four) == ISC_R_SUCCESS); timgr = NULL; @@ -104,13 +111,13 @@ main(int argc, char *argv[]) { isc_interval_set(&interval, 1, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, - &interval, t1, my_tick, "foo", &ti1) == + &interval, t1, my_tick, foo, &ti1) == ISC_R_SUCCESS); ti2 = NULL; isc_interval_set(&interval, 1, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, - &interval, t2, my_tick, "bar", &ti2) == + &interval, t2, my_tick, bar, &ti2) == ISC_R_SUCCESS); printf("task 1 = %p\n", t1); @@ -129,49 +136,49 @@ main(int argc, char *argv[]) { * structure (socket, timer, task, etc) but this is just a test * program. */ - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, sizeof(*event)); isc_task_send(t1, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "2", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, two, sizeof(*event)); isc_task_send(t2, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "3", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, three, sizeof(*event)); isc_task_send(t3, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "4", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, four, sizeof(*event)); isc_task_send(t4, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "2", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, two, sizeof(*event)); isc_task_send(t2, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "3", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, three, sizeof(*event)); isc_task_send(t3, &event); - event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "4", + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, four, sizeof(*event)); isc_task_send(t4, &event); isc_task_purgerange(t3, diff --git a/bin/tests/timer_test.c b/bin/tests/timer_test.c index c0269236bc..1d2a42bf74 100644 --- a/bin/tests/timer_test.c +++ b/bin/tests/timer_test.c @@ -94,6 +94,10 @@ timeout(isc_task_t *task, isc_event_t *event) { isc_task_shutdown(task); } +static char one[] = "1"; +static char two[] = "2"; +static char three[] = "3"; + int main(int argc, char *argv[]) { isc_taskmgr_t *manager = NULL; @@ -123,11 +127,11 @@ main(int argc, char *argv[]) { ISC_R_SUCCESS); RUNTIME_CHECK(isc_task_create(manager, 0, &t3) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t1, shutdown_task, "1") == + RUNTIME_CHECK(isc_task_onshutdown(t1, shutdown_task, one) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t2, shutdown_task, "2") == + RUNTIME_CHECK(isc_task_onshutdown(t2, shutdown_task, two) == ISC_R_SUCCESS); - RUNTIME_CHECK(isc_task_onshutdown(t3, shutdown_task, "3") == + RUNTIME_CHECK(isc_task_onshutdown(t3, shutdown_task, three) == ISC_R_SUCCESS); printf("task 1: %p\n", t1); @@ -138,12 +142,12 @@ main(int argc, char *argv[]) { isc_interval_set(&interval, 2, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, NULL, - &interval, t2, timeout, "2", &ti2) == + &interval, t2, timeout, two, &ti2) == ISC_R_SUCCESS); isc_interval_set(&interval, 1, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, - &interval, t1, tick, "1", &ti1) == + &interval, t1, tick, one, &ti1) == ISC_R_SUCCESS); isc_interval_set(&interval, 10, 0); @@ -151,7 +155,7 @@ main(int argc, char *argv[]) { ISC_R_SUCCESS); isc_interval_set(&interval, 2, 0); RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, &expires, - &interval, t3, timeout, "3", &ti3) == + &interval, t3, timeout, three, &ti3) == ISC_R_SUCCESS); isc_task_detach(&t1);