From f8f474d265967d0529df0d2dd8c16e1d0d74bedb Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 26 Dec 2019 14:48:30 +0000 Subject: Pass correct value into iterator callback for time formats. --- usr.bin/tmux/format.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 1c8b5367e2c..51778d89b8b 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.221 2019/12/26 11:04:58 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.222 2019/12/26 14:48:29 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1150,12 +1150,12 @@ format_each(struct format_tree *ft, void (*cb)(const char *, const char *, void *), void *arg) { struct format_entry *fe; - static char s[64]; + char s[64]; RB_FOREACH(fe, format_entry_tree, &ft->tree) { if (fe->t != 0) { xsnprintf(s, sizeof s, "%lld", (long long)fe->t); - cb(fe->key, fe->value, s); + cb(fe->key, s, arg); } else { if (fe->value == NULL && fe->cb != NULL) { fe->cb(ft, fe); @@ -1198,8 +1198,7 @@ format_add(struct format_tree *ft, const char *key, const char *fmt, ...) static void format_add_tv(struct format_tree *ft, const char *key, struct timeval *tv) { - struct format_entry *fe; - struct format_entry *fe_now; + struct format_entry *fe, *fe_now; fe = xmalloc(sizeof *fe); fe->key = xstrdup(key); -- cgit v1.2.3