From 3344cffe7bf77c984550c01f9405f4d757150d8a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 13 Sep 2019 18:15:09 -0700 Subject: getdigits: introduce `strict`, `def` parameters Problem: During a refactor long ago, we changed the `getdigits_*` familiy of functions to abort on overflow. But this is often wrong, because many of these codepaths are handling user input. Solution: Decide at each call-site whether to use "strict" mode. fix #5555 --- src/nvim/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index 7b6083cf29..3308abc395 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5982,7 +5982,7 @@ file_name_in_line ( ++p; /* skip the separator */ p = skipwhite(p); if (isdigit(*p)) - *file_lnum = getdigits_long(&p); + *file_lnum = getdigits_long(&p, false, 0); } } -- cgit From 6aae0e7c943267d2109ae20ec5086791c3b94a5e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 13 Sep 2019 18:51:13 -0700 Subject: lint --- src/nvim/window.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index 3308abc395..1e6de73549 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5974,15 +5974,17 @@ file_name_in_line ( if (file_lnum != NULL) { char_u *p; - /* Get the number after the file name and a separator character */ + // Get the number after the file name and a separator character. p = ptr + len; p = skipwhite(p); if (*p != NUL) { - if (!isdigit(*p)) - ++p; /* skip the separator */ + if (!isdigit(*p)) { + p++; // skip the separator + } p = skipwhite(p); - if (isdigit(*p)) + if (isdigit(*p)) { *file_lnum = getdigits_long(&p, false, 0); + } } } -- cgit