summaryrefslogtreecommitdiffstats
path: root/window-choose.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-08-12 06:22:26 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-08-12 06:22:26 +0000
commit20129b7bf91d17e69f818b7cea00255e044354c3 (patch)
treeb36dd1f8c09c1440ea0682d9846c1321858e17c3 /window-choose.c
parenta194430e5de1f798913034099f4df72af3d9bd4b (diff)
Simplify width calculation (all numbers always sequential) and don't
rely on uninitialized data, from Thomas Adam.
Diffstat (limited to 'window-choose.c')
-rw-r--r--window-choose.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/window-choose.c b/window-choose.c
index 592d9f7f..da4ab35a 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -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