1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests&examples: apply coding conventions to sizeof

This commit is contained in:
Ludwig Ortmann 2014-07-09 07:15:19 +02:00
parent 06a86aef20
commit 1a8967cb45
7 changed files with 18 additions and 18 deletions

View File

@ -105,8 +105,8 @@ void udp_send(int argc, char **argv)
address = atoi(argv[1]);
strncpy(text, argv[2], sizeof (text));
text[sizeof (text) - 1] = 0;
strncpy(text, argv[2], sizeof(text));
text[sizeof(text) - 1] = 0;
sock = destiny_socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
@ -115,7 +115,7 @@ void udp_send(int argc, char **argv)
return;
}
memset(&sa, 0, sizeof sa);
memset(&sa, 0, sizeof(sa));
ipv6_addr_init(&ipaddr, 0xabcd, 0x0, 0x0, 0x0, 0x3612, 0x00ff, 0xfe00, (uint16_t)address);
@ -125,7 +125,7 @@ void udp_send(int argc, char **argv)
bytes_sent = destiny_socket_sendto(sock, (char *)text,
strlen(text) + 1, 0, &sa,
sizeof sa);
sizeof(sa));
if (bytes_sent < 0) {
printf("Error sending packet!\n");

View File

@ -97,13 +97,13 @@ int main(void)
{
puts("Main thread start.");
pids[0] = thread_create(stacks[0], sizeof (stacks[0]),
pids[0] = thread_create(stacks[0], sizeof(stacks[0]),
PRIORITY_MAIN - 1, CREATE_WOUT_YIELD | CREATE_STACKTEST,
first_thread, "1st");
pids[1] = thread_create(stacks[1], sizeof (stacks[1]),
pids[1] = thread_create(stacks[1], sizeof(stacks[1]),
PRIORITY_MAIN - 2, CREATE_WOUT_YIELD | CREATE_STACKTEST,
second_thread, "2nd");
pids[2] = thread_create(stacks[2], sizeof (stacks[2]),
pids[2] = thread_create(stacks[2], sizeof(stacks[2]),
PRIORITY_MAIN - 3, CREATE_WOUT_YIELD | CREATE_STACKTEST,
third_thread, "3nd");

View File

@ -124,7 +124,7 @@ int main(void)
name = "writer";
}
thread_create(stacks[i], sizeof (stacks[i]), prio, CREATE_WOUT_YIELD | CREATE_STACKTEST, fun, name);
thread_create(stacks[i], sizeof(stacks[i]), prio, CREATE_WOUT_YIELD | CREATE_STACKTEST, fun, name);
}
puts("Main done.");

View File

@ -55,9 +55,9 @@ int main(void)
parent_pid = sched_active_pid;
for (int i = 0; i < NUM_CHILDREN; ++i) {
snprintf(names[i], sizeof (names[i]), "child%2u", i + 1);
snprintf(names[i], sizeof(names[i]), "child%2u", i + 1);
pids[i] = thread_create(stacks[i],
sizeof (stacks[i]),
sizeof(stacks[i]),
PRIORITY_MAIN + 1,
CREATE_WOUT_YIELD | CREATE_STACKTEST,
child_fun,

View File

@ -48,7 +48,7 @@ void timer_thread(void)
/* without a queue, the message would get lost */
/* because of the way this timer works, there can be max 1 queued message */
msg_t msgq[1];
msg_init_queue(msgq, sizeof msgq);
msg_init_queue(msgq, sizeof(msgq));
while (1) {
msg_t m;
@ -90,7 +90,7 @@ int main(void)
msg_t m;
int pid = thread_create(
timer_stack,
sizeof timer_stack,
sizeof(timer_stack),
PRIORITY_MAIN - 1,
CREATE_STACKTEST,
timer_thread,
@ -106,7 +106,7 @@ int main(void)
int pid2 = thread_create(
timer_stack_local,
sizeof timer_stack_local,
sizeof(timer_stack_local),
PRIORITY_MAIN - 1,
CREATE_STACKTEST,
timer_thread_local,

View File

@ -56,7 +56,7 @@ void timer_thread(void)
printf("This is thread %d\n", thread_getpid());
msg_t msgq[16];
msg_init_queue(msgq, sizeof msgq);
msg_init_queue(msgq, sizeof(msgq));
while (1) {
msg_t m;
@ -102,7 +102,7 @@ int main(void)
msg_t m;
int pid = thread_create(
timer_stack,
sizeof timer_stack,
sizeof(timer_stack),
PRIORITY_MAIN - 1,
CREATE_STACKTEST,
timer_thread,

View File

@ -159,7 +159,7 @@ static void test_bitarithm_msb_random(void)
static void test_bitarithm_msb_all(void)
{
for (unsigned shift = 0; shift < sizeof (unsigned) * 8 - 1; ++shift) {
for (unsigned shift = 0; shift < sizeof(unsigned) * 8 - 1; ++shift) {
TEST_ASSERT_EQUAL_INT(shift, bitarithm_msb(1 << shift));
}
}
@ -171,7 +171,7 @@ static void test_bitarithm_lsb_one(void)
static void test_bitarithm_lsb_limit(void)
{
unsigned shift = sizeof (unsigned) * 8 - 1;
unsigned shift = sizeof(unsigned) * 8 - 1;
TEST_ASSERT_EQUAL_INT(shift, bitarithm_lsb(1u << shift));
}
@ -183,7 +183,7 @@ static void test_bitarithm_lsb_random(void)
static void test_bitarithm_lsb_all(void)
{
for (unsigned shift = 0; shift < sizeof (unsigned) * 8 - 1; ++shift) {
for (unsigned shift = 0; shift < sizeof(unsigned) * 8 - 1; ++shift) {
TEST_ASSERT_EQUAL_INT(shift, bitarithm_lsb(1u << shift));
}
}