From f2c52551bbfe859c05bfb86edc1274664a6bb052 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 9 May 2011 08:17:03 +0200 Subject: [PATCH] Use error codes when checking parse_int() return value Usually, OPT_OK != OK, so we'd usually treat success as an error, leading e.g. to errors like "Unable to parse '42' as a line number". Reported by Christian Ohm in Debian bug #626124. Signed-off-by: Sebastian Harl --- tig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tig.c b/tig.c index 2baf56c..2767fde 100644 --- a/tig.c +++ b/tig.c @@ -1029,7 +1029,7 @@ set_color(int *color, const char *name) if (map_enum(color, color_map, name)) return TRUE; if (!prefixcmp(name, "color")) - return parse_int(color, name + 5, 0, 255) == OK; + return parse_int(color, name + 5, 0, 255) == OPT_OK; return FALSE; } @@ -6916,7 +6916,7 @@ main(int argc, const char *argv[]) if (cmd && isdigit(*cmd)) { int lineno = view->lineno + 1; - if (parse_int(&lineno, cmd, 1, view->lines + 1) == OK) { + if (parse_int(&lineno, cmd, 1, view->lines + 1) == OPT_OK) { select_view_line(view, lineno - 1); report(""); } else { -- 2.30.2