From 20129b7bf91d17e69f818b7cea00255e044354c3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 12 Aug 2012 06:22:26 +0000 Subject: [PATCH] Simplify width calculation (all numbers always sequential) and don't rely on uninitialized data, from Thomas Adam. --- window-choose.c | 5 +---- 1 file changed, 1 insertion(+), 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