nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 3c2eb96243e4411e41c6dc94c3054f79bc20af14
parent de313586aba3b3d2cb43e0a2c027900d3bccac14
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed, 21 Oct 2020 12:24:52 +0200

tweaks: rename two variables and improve two comments

Diffstat:
Msrc/utils.c | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/utils.c b/src/utils.c @@ -108,19 +108,19 @@ int digits(ssize_t n) } #endif -/* Read an integer from str. If it parses okay, store it in *result - * and return TRUE; otherwise, return FALSE. */ -bool parse_num(const char *str, ssize_t *result) +/* Read an integer from the given string. If it parses okay, + * store it in *result and return TRUE; otherwise, return FALSE. */ +bool parse_num(const char *string, ssize_t *result) { - char *first_error; ssize_t value; + char *excess; - /* The manual page for strtol() says this is required. */ + /* Clear the error number so that we can check it afterward. */ errno = 0; - value = (ssize_t)strtol(str, &first_error, 10); + value = (ssize_t)strtol(string, &excess, 10); - if (errno == ERANGE || *str == '\0' || *first_error != '\0') + if (errno == ERANGE || *string == '\0' || *excess != '\0') return FALSE; *result = value;