mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-30 22:24:41 +03:00
tweaks: rename two variables and improve two comments
This commit is contained in:
parent
de313586ab
commit
3c2eb96243
14
src/utils.c
14
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;
|
||||
|
Loading…
Reference in New Issue
Block a user