summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-choose.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-08-12 06:22:27 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-08-12 06:22:27 +0000
commit78ad4b4b80b601223e38d9e13929fae98ca8b20a (patch)
tree3e55112eba32deb0cbfb65f94e797e2f50cdd065 /usr.bin/tmux/window-choose.c
parent2c05895d78bbd1cb157721c30162b72f7894153a (diff)
Simplify width calculation (all numbers always sequential) and don't
rely on uninitialized data, from Thomas Adam.
Diffstat (limited to 'usr.bin/tmux/window-choose.c')
-rw-r--r--usr.bin/tmux/window-choose.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.bin/tmux/window-choose.c b/usr.bin/tmux/window-choose.c
index 2a2baa638cf..ffe9da09aef 100644
--- a/usr.bin/tmux/window-choose.c
+++ b/usr.bin/tmux/window-choose.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-choose.c,v 1.22 2012/08/11 06:45:33 nicm Exp $ */
+/* $OpenBSD: window-choose.c,v 1.23 2012/08/12 06:22:26 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -80,7 +80,6 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
{
struct window_choose_mode_data *data = wp->modedata;
struct window_choose_mode_item *item;
- int width;
char tmp[10];
ARRAY_EXPAND(&data->list, 1);
@@ -90,9 +89,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
item->wcd = wcd;
item->pos = ARRAY_LENGTH(&data->list) - 1;
- width = snprintf (tmp, sizeof tmp, "%u", item->pos);
- if (width > data->width)
- data->width = width;
+ data->width = snprintf (tmp, sizeof tmp , "%u", item->pos);
}
void