summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPunit Agrawal <punit1.agrawal@toshiba.co.jp>2021-10-14 16:12:42 +0900
committerJohn Kacur <jkacur@redhat.com>2021-11-11 15:29:18 -0500
commitb1f89cadcb19be9d95173485d8d002f2009d9638 (patch)
tree9a59c85bc903fd71fe002cc7f2849b764de1f043
parent85d13f3e712bb2a1d61f2a378a7583c2a4a779f5 (diff)
downloadrt-tests-b1f89cadcb19be9d95173485d8d002f2009d9638.tar.gz
rt-tests: cyclictest: Simplify duplicate initialization of "stop"
The timespec structure "stop" is initialised whether it is used or not as the compiler is not smart enough to figure out that it's use is always guarded by the "duration" variable. As a result, "stop" needs to be initialised whether it's used or not to avoid a compiler warning. Replace the duplicate memset statements by initializing "stop" using structure initialiser. Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--src/cyclictest/cyclictest.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 5758f88..73c5be9 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -507,7 +507,7 @@ static void *timerthread(void *param)
struct sigevent sigev;
sigset_t sigset;
timer_t timer;
- struct timespec now, next, interval, stop;
+ struct timespec now, next, interval, stop = { 0 };
struct itimerval itimer;
struct itimerspec tspec;
struct thread_stat *stat = par->stats;
@@ -516,8 +516,6 @@ static void *timerthread(void *param)
pthread_t thread;
unsigned long smi_now, smi_old = 0;
- memset(&stop, 0, sizeof(stop));
-
/* if we're running in numa mode, set our memory node */
if (par->node != -1)
rt_numa_set_numa_run_on_node(par->node, par->cpu);
@@ -598,7 +596,6 @@ static void *timerthread(void *param)
tsnorm(&next);
if (duration) {
- memset(&stop, 0, sizeof(stop)); /* grrr */
stop = now;
stop.tv_sec += duration;
}