diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 10:32:54 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-25 10:32:54 -0600 |
commit | b756c4b51f51427339bf3649430f8470f64d7a8d (patch) | |
tree | 33df50ce9e2a880b0c892fd49e423bab8ed1d4a5 /apps/examples/elf | |
parent | 40205b8ce91e12a08e7148670ca09eef74265843 (diff) | |
download | nuttx-b756c4b51f51427339bf3649430f8470f64d7a8d.tar.gz nuttx-b756c4b51f51427339bf3649430f8470f64d7a8d.tar.bz2 nuttx-b756c4b51f51427339bf3649430f8470f64d7a8d.zip |
Fixes for more complaints from cppcheck
Diffstat (limited to 'apps/examples/elf')
-rw-r--r-- | apps/examples/elf/tests/mutex/mutex.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/apps/examples/elf/tests/mutex/mutex.c b/apps/examples/elf/tests/mutex/mutex.c index 2446e62eb..0d5ff1d2a 100644 --- a/apps/examples/elf/tests/mutex/mutex.c +++ b/apps/examples/elf/tests/mutex/mutex.c @@ -76,29 +76,29 @@ void thread_func(void *parameter) for (i = 0; i < 20 && !bendoftest; i++); { if ((pthread_mutex_lock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_lock failed\n", my_id); - } + { + printf("ERROR thread %d: pthread_mutex_lock failed\n", my_id); + } if (my_mutex == 1) - { - printf("ERROR thread=%d: " - "my_mutex should be zero, instead my_mutex=%d\n", - my_id, my_mutex); - nerrors[my_ndx]++; - } + { + printf("ERROR thread=%d: " + "my_mutex should be zero, instead my_mutex=%d\n", + my_id, my_mutex); + nerrors[my_ndx]++; + } my_mutex = 1; usleep(100000); my_mutex = 0; - + if ((pthread_mutex_unlock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_unlock failed\n", my_id); - } + { + printf("ERROR thread %d: pthread_mutex_unlock failed\n", my_id); + } nloops[my_ndx]++; - } + } } /**************************************************************************** @@ -141,9 +141,8 @@ int main(int argc, char **argv) pthread_join(thread2, NULL); printf("\tThread1\tThread2\n"); - printf("Loops\t%ld\t%ld\n", nloops[0], nloops[1]); - printf("Errors\t%ld\t%ld\n", nerrors[0], nerrors[1]); + printf("Loops\t%lu\t%lu\n", nloops[0], nloops[1]); + printf("Errors\t%lu\t%lu\n", nerrors[0], nerrors[1]); return 0; } - |