diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-04-08 07:51:38 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-03 06:58:53 +0200 |
commit | 5b97821bc8583a71e30d6a27bf29961e2c9dc522 (patch) | |
tree | 5d0ee751af980019549583e73f2741a521e950c2 /cpukit/libtest | |
parent | score: Add _Thread_Dispatch_direct_no_return() (diff) | |
download | rtems-5b97821bc8583a71e30d6a27bf29961e2c9dc522.tar.bz2 |
libtest: Fix use of flexible array member
Flexible array members must not appear in the middle of a structure.
Diffstat (limited to 'cpukit/libtest')
-rw-r--r-- | cpukit/libtest/t-test-thread-switch.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/cpukit/libtest/t-test-thread-switch.c b/cpukit/libtest/t-test-thread-switch.c index 87ad4651fc..60179aaa40 100644 --- a/cpukit/libtest/t-test-thread-switch.c +++ b/cpukit/libtest/t-test-thread-switch.c @@ -96,11 +96,11 @@ T_thread_switch_recorder(Thread_Control *executing, Thread_Control *heir) if (log != NULL) { size_t recorded; - ++log->switches; - recorded = log->recorded; + ++log->header.switches; + recorded = log->header.recorded; - if (recorded < log->capacity) { - log->recorded = recorded + 1; + if (recorded < log->header.capacity) { + log->header.recorded = recorded + 1; log->events[recorded].executing = executing->Object.id; log->events[recorded].heir = heir->Object.id; log->events[recorded].cpu = @@ -127,8 +127,8 @@ T_thread_switch_record(T_thread_switch_log *log) } if (log != NULL) { - log->recorded = 0; - log->switches = 0; + log->header.recorded = 0; + log->header.switches = 0; } rtems_interrupt_lock_acquire(&ctx->lock, &lock_context); @@ -142,20 +142,20 @@ T_thread_switch_record(T_thread_switch_log *log) T_thread_switch_log * T_thread_switch_record_2(T_thread_switch_log_2 *log) { - log->log.capacity = 2; - return T_thread_switch_record(&log->log); + log->header.capacity = T_ARRAY_SIZE(log->events); + return T_thread_switch_record((T_thread_switch_log *)log); } T_thread_switch_log * T_thread_switch_record_4(T_thread_switch_log_4 *log) { - log->log.capacity = 4; - return T_thread_switch_record(&log->log); + log->header.capacity = T_ARRAY_SIZE(log->events); + return T_thread_switch_record((T_thread_switch_log *)log); } T_thread_switch_log * T_thread_switch_record_10(T_thread_switch_log_10 *log) { - log->log.capacity = 10; - return T_thread_switch_record(&log->log); + log->header.capacity = T_ARRAY_SIZE(log->events); + return T_thread_switch_record((T_thread_switch_log *)log); } |