[PATCH 48/52] samples/unlimited: Fix printf() warning and clean up
Joel Sherrill
joel.sherrill at oarcorp.com
Wed Oct 8 19:16:39 UTC 2014
---
testsuites/samples/unlimited/init.c | 23 ++++++++++++++---------
testsuites/samples/unlimited/system.h | 2 +-
testsuites/samples/unlimited/test1.c | 2 +-
testsuites/samples/unlimited/test2.c | 28 ++++++++++++++++------------
testsuites/samples/unlimited/test3.c | 2 +-
5 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/testsuites/samples/unlimited/init.c b/testsuites/samples/unlimited/init.c
index 06e0c3a..0fb5505 100644
--- a/testsuites/samples/unlimited/init.c
+++ b/testsuites/samples/unlimited/init.c
@@ -55,20 +55,21 @@ rtems_task Init(
rtems_task test_task(
rtems_task_argument my_number
- )
+)
{
rtems_event_set out;
+ unsigned int my_n = (unsigned int) my_number;
- printf( "task %" PRIdrtems_task_argument " has started.\n", my_number);
+ printf( "task %" PRIdrtems_task_argument " has started.\n", my_n);
rtems_event_receive(1, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &out);
- printf( "task %" PRIdrtems_task_argument " ending.\n", my_number);
+ printf( "task %" PRIdrtems_task_argument " ending.\n", my_n);
rtems_task_delete(RTEMS_SELF);
}
-void destory_all_tasks(
+void destroy_all_tasks(
const char *who
)
{
@@ -78,19 +79,23 @@ void destory_all_tasks(
* If the id is not zero, signal the task to delete.
*/
- for (task = 0; task < MAX_TASKS; task++)
- if (task_id[task])
- {
- printf(" %s : signal task %08" PRIxrtems_id " to delete, ", who, task_id[task]);
+ for (task = 0; task < MAX_TASKS; task++) {
+ if (task_id[task]) {
+ printf(
+ " %s : signal task %08" PRIxrtems_id " to delete, ",
+ who,
+ task_id[task]
+ );
fflush(stdout);
rtems_event_send(task_id[task], 1);
task_id[task] = 0;
}
+ }
}
bool status_code_bad(
rtems_status_code status_code
- )
+)
{
if (status_code != RTEMS_SUCCESSFUL)
{
diff --git a/testsuites/samples/unlimited/system.h b/testsuites/samples/unlimited/system.h
index 911aa69..5da5d06 100644
--- a/testsuites/samples/unlimited/system.h
+++ b/testsuites/samples/unlimited/system.h
@@ -24,7 +24,7 @@ rtems_task test_task(
);
void
-destory_all_tasks(
+destroy_all_tasks(
const char *who
);
diff --git a/testsuites/samples/unlimited/test1.c b/testsuites/samples/unlimited/test1.c
index 9d90af0..f02857c 100644
--- a/testsuites/samples/unlimited/test1.c
+++ b/testsuites/samples/unlimited/test1.c
@@ -99,7 +99,7 @@ void test1()
exit( 1 );
}
- destory_all_tasks("TEST1");
+ destroy_all_tasks("TEST1");
the_information->auto_extend = auto_extend;
diff --git a/testsuites/samples/unlimited/test2.c b/testsuites/samples/unlimited/test2.c
index 911451f..411a401 100644
--- a/testsuites/samples/unlimited/test2.c
+++ b/testsuites/samples/unlimited/test2.c
@@ -95,7 +95,7 @@ void test2()
printf( " FAIL2 : not enough tasks created -\n"
" task created = %" PRIi32 ", required number = %i\n",
task_count, (TASK_ALLOCATION_SIZE * 5) - TASK_INDEX_OFFSET);
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
exit( 1 );
}
@@ -112,7 +112,7 @@ void test2()
printf( " FAIL2 : remove task has a 0 id -\n"
" task number = %" PRIi32 "\n",
remove_task);
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
exit( 1 );
}
@@ -122,7 +122,8 @@ void test2()
removed_ids[task++] = task_id[remove_task];
- printf(" TEST2 : block %" PRIi32 " remove, signal task %08" PRIxrtems_id ", ", block, task_id[remove_task]);
+ printf(" TEST2 : block %" PRIi32 " remove, signal task %08"
+ PRIxrtems_id ", ", block, task_id[remove_task]);
rtems_event_send(task_id[remove_task], 1);
task_id[remove_task] = 0;
}
@@ -144,7 +145,7 @@ void test2()
if (id_slot == MAX_TASKS)
{
printf( " FAIL2 : no free task id slot.\n");
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
exit( 1 );
}
@@ -164,11 +165,12 @@ void test2()
printf( " FAIL2 : re-creating a task -\n"
" task number = %" PRIi32 "\n",
id_slot);
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
exit( 1 );
}
- printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", task_count, task_id[id_slot]);
+ printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ",
+ task_count, task_id[id_slot]);
result = rtems_task_start(task_id[id_slot],
test_task,
@@ -179,7 +181,7 @@ void test2()
printf( " FAIL : re-starting a task -\n"
" task number = %" PRIi32 "\n",
id_slot);
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
exit( 1 );
}
@@ -190,7 +192,8 @@ void test2()
NEXT_TASK_NAME(c1, c2, c3, c4);
/*
- * Search the removed ids to see if it existed, clear the removed id when found
+ * Search the removed ids to see if it existed, clear the removed id
+ * when found
*/
for (remove_task = 0; remove_task < (TASK_ALLOCATION_SIZE * 2); remove_task++)
@@ -212,9 +215,10 @@ void test2()
for (allocated_id = 0; allocated_id < MAX_TASKS; allocated_id++)
if ((task_id[id_slot] == task_id[allocated_id]) && (id_slot != allocated_id))
{
- printf( " FAIL2 : the new id is the same as an id already allocated -\n"
- " task id = %08" PRIxrtems_id "\n",
- task_id[id_slot]);
+ printf(
+ " FAIL2 : the new id is the same as an id already allocated -\n"
+ " task id = %08" PRIxrtems_id "\n",
+ task_id[id_slot]);
exit( 1 );
}
@@ -227,7 +231,7 @@ void test2()
task_count++;
}
- destory_all_tasks("TEST2");
+ destroy_all_tasks("TEST2");
printf( " TEST2 : completed\n" );
}
diff --git a/testsuites/samples/unlimited/test3.c b/testsuites/samples/unlimited/test3.c
index 247d175..6330f3c 100644
--- a/testsuites/samples/unlimited/test3.c
+++ b/testsuites/samples/unlimited/test3.c
@@ -144,7 +144,7 @@ void test3()
}
}
- destory_all_tasks("TEST3");
+ destroy_all_tasks("TEST3");
printf( " TEST3 : completed\n" );
}
--
1.9.3
More information about the devel
mailing list