vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 50278157bbff2e950fe6a75a6802c3f73fc214a1
parent 59b9ea293d70277945494640acdeb9e4b2980bcb
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed,  4 Nov 2020 09:04:05 +0100

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.

Diffstat:
Mvis-cmds.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 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;