From: Sebastian Harl Date: Mon, 9 May 2011 06:17:03 +0000 (+0200) Subject: Use error codes when checking parse_int() return value X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=refs%2Fheads%2Fsh%2Fnext;p=tig.git 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 --- 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 {