From 5f89bf5b4e891469a5ef6a0f27ae3976191ce1c2 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 11 Aug 2016 21:26:51 +0200 Subject: [PATCH] Avoid unnecessary test --- src/ui/gui/psppire-import-assistant.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ui/gui/psppire-import-assistant.c b/src/ui/gui/psppire-import-assistant.c index bb29d04993..98219fd6f4 100644 --- a/src/ui/gui/psppire-import-assistant.c +++ b/src/ui/gui/psppire-import-assistant.c @@ -1714,18 +1714,24 @@ make_data_column (PsppireImportAssistant *ia, GtkWidget *tree_view, { struct variable *var = NULL; struct column *column = NULL; - size_t char_cnt; + size_t char_cnt = 0; gint content_width, header_width; PsppSheetViewColumn *tree_column; - char *name; + char *name = NULL; if (input) - column = &ia->columns[dict_idx]; + { + column = &ia->columns[dict_idx]; + name = escape_underscores (column->name); + char_cnt = column->width; + } else - var = dict_get_var (ia->dict, dict_idx); + { + var = dict_get_var (ia->dict, dict_idx); + name = escape_underscores (var_get_name (var)); + char_cnt = var_get_print_format (var)->w; + } - name = escape_underscores (input ? column->name : var_get_name (var)); - char_cnt = input ? column->width : var_get_print_format (var)->w; content_width = get_monospace_width (tree_view, ia->fixed_renderer, char_cnt); header_width = get_string_width (tree_view, ia->prop_renderer, -- 2.30.2