Commit 3b9a0696 authored by Mark Andrews's avatar Mark Andrews
Browse files

1723. [cleanup] Silence compiler warnings from t_tasks.c. [RT #12493]

parent f8ea1583
1723. [cleanup] Silence compiler warnings from t_tasks.c. [RT #12493]
1722. [bug] Don't commit the journal on malformed ixfr streams.
[RT #12519]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_tasks.c,v 1.33 2004/06/21 05:36:41 marka Exp $ */
/* $Id: t_tasks.c,v 1.34 2004/09/21 02:12:08 marka Exp $ */
#include <config.h>
......@@ -38,6 +38,8 @@ isc_boolean_t threaded = ISC_TRUE;
isc_boolean_t threaded = ISC_FALSE;
#endif
static int senders[4];
static void
require_threads(void) {
t_info("This test requires threads\n");
......@@ -665,7 +667,6 @@ t_tasks3(void) {
unsigned int workers;
isc_event_t *event;
isc_result_t isc_result;
void *sender;
isc_eventtype_t event_type;
T3_flag = 0;
......@@ -674,7 +675,6 @@ t_tasks3(void) {
T3_nfails = 0;
T3_nprobs = 0;
sender = (void *) 1;
event_type = 3;
workers = 2;
......@@ -738,15 +738,15 @@ t_tasks3(void) {
/*
* This event causes the task to wait on T3_cv.
*/
event = isc_event_allocate(mctx, sender, event_type, t3_event1, NULL,
sizeof(*event));
event = isc_event_allocate(mctx, &senders[1], event_type, t3_event1,
NULL, sizeof(*event));
isc_task_send(task, &event);
/*
* Now we fill up the task's event queue with some events.
*/
for (cnt = 0; cnt < T3_NEVENTS; ++cnt) {
event = isc_event_allocate(mctx, sender, event_type,
event = isc_event_allocate(mctx, &senders[1], event_type,
t3_event2, NULL, sizeof(*event));
isc_task_send(task, &event);
}
......@@ -886,7 +886,6 @@ t_tasks4(void) {
isc_task_t *task;
unsigned int workers;
isc_result_t isc_result;
void *sender;
isc_eventtype_t event_type;
isc_event_t *event;
......@@ -895,7 +894,6 @@ t_tasks4(void) {
T4_flag = 0;
result = T_UNRESOLVED;
sender = (void *)1;
event_type = 4;
workers = 2;
......@@ -965,8 +963,8 @@ t_tasks4(void) {
/*
* This event causes the task to wait on T4_cv.
*/
event = isc_event_allocate(mctx, sender, event_type, t4_event1, NULL,
sizeof(*event));
event = isc_event_allocate(mctx, &senders[1], event_type, t4_event1,
NULL, sizeof(*event));
isc_task_send(task, &event);
isc_task_shutdown(task);
......@@ -1085,7 +1083,6 @@ t_tasks7(void) {
isc_task_t *task;
unsigned int workers;
isc_result_t isc_result;
void *sender;
isc_eventtype_t event_type;
isc_event_t *event;
isc_time_t now;
......@@ -1097,7 +1094,6 @@ t_tasks7(void) {
T7_eflag = 0;
result = T_UNRESOLVED;
sender = (void *)1;
event_type = 7;
workers = 2;
......@@ -1176,8 +1172,8 @@ t_tasks7(void) {
return(T_UNRESOLVED);
}
event = isc_event_allocate(mctx, sender, event_type, t7_event1, NULL,
sizeof(*event));
event = isc_event_allocate(mctx, &senders[1], event_type, t7_event1,
NULL, sizeof(*event));
isc_task_send(task, &event);
isc_task_shutdown(task);
......@@ -1324,7 +1320,7 @@ t10_event2(isc_task_t *task, isc_event_t *event) {
"NP" : "P");
}
if ((T10_purge_sender == 0) ||
if ((T10_purge_sender == NULL) ||
(T10_purge_sender == event->ev_sender)) {
sender_match = 1;
}
......@@ -1394,7 +1390,7 @@ t10_sde(isc_task_t *task, isc_event_t *event) {
}
static void
t_taskpurge_x(int sender, int type, int tag, int purge_sender,
t_taskpurge_x(int sender, int type, int tag, void *purge_sender,
int purge_type_first, int purge_type_last, void *purge_tag,
int exp_nevents, int *nfails, int *nprobs, int testrange)
{
......@@ -1419,7 +1415,7 @@ t_taskpurge_x(int sender, int type, int tag, int purge_sender,
T10_startflag = 0;
T10_shutdownflag = 0;
T10_eventcnt = 0;
T10_purge_sender = (void *) purge_sender;
T10_purge_sender = purge_sender;
T10_purge_type_first = (isc_eventtype_t) purge_type_first;
T10_purge_type_last = (isc_eventtype_t) purge_type_last;
T10_purge_tag = purge_tag;
......@@ -1515,7 +1511,7 @@ t_taskpurge_x(int sender, int type, int tag, int purge_sender,
for (tag_cnt = 0; tag_cnt < T10_TAGCNT; ++tag_cnt) {
eventtab[event_cnt] =
isc_event_allocate(mctx,
(void *)(sender + sender_cnt),
&senders[sender + sender_cnt],
(isc_eventtype_t)(type + type_cnt),
t10_event2, NULL, sizeof(*event));
......@@ -1544,7 +1540,7 @@ t_taskpurge_x(int sender, int type, int tag, int purge_sender,
/*
* We're testing isc_task_purge.
*/
nevents = isc_task_purge(task, (void *)purge_sender,
nevents = isc_task_purge(task, purge_sender,
(isc_eventtype_t)purge_type_first,
purge_tag);
if (nevents != exp_nevents) {
......@@ -1557,7 +1553,7 @@ t_taskpurge_x(int sender, int type, int tag, int purge_sender,
/*
* We're testing isc_task_purgerange.
*/
nevents = isc_task_purgerange(task, (void *)purge_sender,
nevents = isc_task_purgerange(task, purge_sender,
(isc_eventtype_t)purge_type_first,
(isc_eventtype_t)purge_type_last,
purge_tag);
......@@ -1663,34 +1659,36 @@ t_tasks10(void) {
* Try purging on a specific sender.
*/
t_info("testing purge on 2,4,8 expecting 1\n");
t_taskpurge_x(1, 4, 7, 2, 4, 4, (void *)8, 1, &T10_nfails,
t_taskpurge_x(1, 4, 7, &senders[2], 4, 4, (void *)8, 1, &T10_nfails,
&T10_nprobs, 0);
/*
* Try purging on all senders.
*/
t_info("testing purge on 0,4,8 expecting 3\n");
t_taskpurge_x(1, 4, 7, 0, 4, 4, (void *)8, 3, &T10_nfails,
t_taskpurge_x(1, 4, 7, NULL, 4, 4, (void *)8, 3, &T10_nfails,
&T10_nprobs, 0);
/*
* Try purging on all senders, specified type, all tags.
*/
t_info("testing purge on 0,4,0 expecting 15\n");
t_taskpurge_x(1, 4, 7, 0, 4, 4, NULL, 15, &T10_nfails, &T10_nprobs, 0);
t_taskpurge_x(1, 4, 7, NULL, 4, 4, NULL, 15, &T10_nfails,
&T10_nprobs, 0);
/*
* Try purging on a specified tag, no such type.
*/
t_info("testing purge on 0,99,8 expecting 0\n");
t_taskpurge_x(1, 4, 7, 0, 99, 99, (void *)8, 0, &T10_nfails,
t_taskpurge_x(1, 4, 7, NULL, 99, 99, (void *)8, 0, &T10_nfails,
&T10_nprobs, 0);
/*
* Try purging on specified sender, type, all tags.
*/
t_info("testing purge on 0,5,0 expecting 5\n");
t_taskpurge_x( 1, 4, 7, 3, 5, 5, NULL, 5, &T10_nfails, &T10_nprobs, 0);
t_taskpurge_x(1, 4, 7, &senders[3], 5, 5, NULL, 5, &T10_nfails,
&T10_nprobs, 0);
result = T_UNRESOLVED;
......@@ -2042,68 +2040,69 @@ t_tasks13(void) {
* Try purging on a specific sender.
*/
t_info("testing purge on 2,4,8 expecting 1\n");
t_taskpurge_x(1, 4, 7, 2, 4, 4, (void *)8, 1,
t_taskpurge_x(1, 4, 7, &senders[2], 4, 4, (void *)8, 1,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on all senders.
*/
t_info("testing purge on 0,4,8 expecting 3\n");
t_taskpurge_x(1, 4, 7, 0, 4, 4, (void *)8, 3,
t_taskpurge_x(1, 4, 7, NULL, 4, 4, (void *)8, 3,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on all senders, specified type, all tags.
*/
t_info("testing purge on 0,4,0 expecting 15\n");
t_taskpurge_x(1, 4, 7, 0, 4, 4, NULL, 15, &T13_nfails, &T13_nprobs, 1);
t_taskpurge_x(1, 4, 7, NULL, 4, 4, NULL, 15, &T13_nfails, &T13_nprobs, 1);
/*
* Try purging on a specified tag, no such type.
*/
t_info("testing purge on 0,99,8 expecting 0\n");
t_taskpurge_x(1, 4, 7, 0, 99, 99, (void *)8, 0,
t_taskpurge_x(1, 4, 7, NULL, 99, 99, (void *)8, 0,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on specified sender, type, all tags.
*/
t_info("testing purge on 3,5,0 expecting 5\n");
t_taskpurge_x(1, 4, 7, 3, 5, 5, 0, 5, &T13_nfails, &T13_nprobs, 1);
t_taskpurge_x(1, 4, 7, &senders[3], 5, 5, 0, 5, &T13_nfails, &T13_nprobs, 1);
/*
* Now let's try some ranges.
*/
t_info("testing purgerange on 2,4-5,8 expecting 2\n");
t_taskpurge_x(1, 4, 7, 2, 4, 5, (void *)8, 1,
t_taskpurge_x(1, 4, 7, &senders[2], 4, 5, (void *)8, 1,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on all senders.
*/
t_info("testing purge on 0,4-5,8 expecting 5\n");
t_taskpurge_x(1, 4, 7, 0, 4, 5, (void *)8, 5,
t_taskpurge_x(1, 4, 7, NULL, 4, 5, (void *)8, 5,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on all senders, specified type, all tags.
*/
t_info("testing purge on 0,5-6,0 expecting 28\n");
t_taskpurge_x(1, 4, 7, 0, 5, 6, NULL, 28, &T13_nfails, &T13_nprobs, 1);
t_taskpurge_x(1, 4, 7, NULL, 5, 6, NULL, 28, &T13_nfails, &T13_nprobs, 1);
/*
* Try purging on a specified tag, no such type.
*/
t_info("testing purge on 0,99-101,8 expecting 0\n");
t_taskpurge_x(1, 4, 7, 0, 99, 101, (void *)8, 0,
t_taskpurge_x(1, 4, 7, NULL, 99, 101, (void *)8, 0,
&T13_nfails, &T13_nprobs, 1);
/*
* Try purging on specified sender, type, all tags.
*/
t_info("testing purge on 3,5-6,0 expecting 10\n");
t_taskpurge_x(1, 4, 7, 3, 5, 6, NULL, 10, &T13_nfails, &T13_nprobs, 1);
t_taskpurge_x(1, 4, 7, &senders[3], 5, 6, NULL, 10, &T13_nfails,
&T13_nprobs, 1);
result = T_UNRESOLVED;
......@@ -2137,7 +2136,8 @@ int t14_active[T14_NTASKS];
static void
t14_callback(isc_task_t *task, isc_event_t *event) {
int taskno = (int) event->ev_arg;
int taskno = *(int *)(event->ev_arg);
t_info("task enter %d\n", taskno);
if (taskno == T14_EXCLTASK) {
......@@ -2158,6 +2158,7 @@ t14_callback(isc_task_t *task, isc_event_t *event) {
}
t_info("task exit %d\n", taskno);
if (t14_done) {
isc_mem_put(event->ev_destroy_arg, event->ev_arg, sizeof (int));
isc_event_free(&event);
} else {
isc_task_send(task, &event);
......@@ -2214,6 +2215,7 @@ t_tasks14(void) {
for (i = 0; i < T14_NTASKS; i++) {
isc_event_t *event;
int *v;
isc_result = isc_task_create(manager, 0, &tasks[i]);
if (isc_result != ISC_R_SUCCESS) {
......@@ -2221,9 +2223,18 @@ t_tasks14(void) {
return(T_FAIL);
}
v = isc_mem_get(mctx, sizeof *v);
if (v == NULL) {
isc_task_detach(&tasks[i]);
t_info("isc_mem_get failed\n");
return(T_FAIL);
}
*v = i;
event = isc_event_allocate(mctx, NULL, 1, t14_callback,
(void *)i, sizeof(*event));
v, sizeof(*event));
if (event == NULL) {
isc_mem_put(mctx, v, sizeof *v);
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment