diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2020-11-04 09:04:05 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2020-11-13 11:41:44 +0100 |
| commit | 18c908073e2de9ff6360ff5341283681f3cbac64 (patch) | |
| tree | c161096adf315e779773b30d8a614258323b35d3 | |
| parent | f95cf946cebf75bacaa130d3268e2010b5e07746 (diff) | |
| download | vis-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |
