aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-11-04 09:04:05 +0100
committerMarc André Tanner <mat@brain-dump.org>2020-11-13 11:41:44 +0100
commit18c908073e2de9ff6360ff5341283681f3cbac64 (patch)
treec161096adf315e779773b30d8a614258323b35d3
parentf95cf946cebf75bacaa130d3268e2010b5e07746 (diff)
downloadvis-18c908073e2de9ff6360ff5341283681f3cbac64.tar.gz
vis-18c908073e2de9ff6360ff5341283681f3cbac64.tar.xz
vis: use localtime_r(3) instead of localtime(3)
This makes it thread safe. While it is unlikely that we use threads in the near future, it is sensible to avoid unnecessary global state.
-rw-r--r--vis-cmds.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vis-cmds.c b/vis-cmds.c
index 181321e..f5221d1 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -619,9 +619,10 @@ static bool cmd_earlier_later(Vis *vis, Win *win, Command *cmd, const char *argv
}
}
+ struct tm tm;
time_t state = text_state(txt);
char buf[32];
- strftime(buf, sizeof buf, "State from %H:%M", localtime(&state));
+ strftime(buf, sizeof buf, "State from %H:%M", localtime_r(&state, &tm));
vis_info_show(vis, "%s", buf);
return pos != EPOS;