aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/charset.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-13 17:23:02 -0700
committerJustin M. Keyes <justinkz@gmail.com>2019-09-13 19:13:00 -0700
commit0a24a2c314a507108be754a0a2d2ed1a16ec523f (patch)
tree8228647f9e05e479884b838ef10de28ef3c2dd3d /src/nvim/charset.c
parent427cf16e44d047c14e0ca1b95eb09fc8b8eb2f3d (diff)
downloadrneovim-0a24a2c314a507108be754a0a2d2ed1a16ec523f.tar.gz
rneovim-0a24a2c314a507108be754a0a2d2ed1a16ec523f.tar.bz2
rneovim-0a24a2c314a507108be754a0a2d2ed1a16ec523f.zip
rename: getdigits_safe => try_getdigits
Diffstat (limited to 'src/nvim/charset.c')
-rw-r--r--src/nvim/charset.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 1dec0beeee..0587630336 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1601,18 +1601,18 @@ char_u* skiptowhite_esc(char_u *p) {
/// It will be advanced past the read number.
/// @param[out] nr Number read from the string.
///
-/// @return OK on success, FAIL on error/overflow
-int getdigits_safe(char_u **pp, intmax_t *nr)
+/// @return true on success, false on error/overflow
+bool try_getdigits(char_u **pp, intmax_t *nr)
{
errno = 0;
*nr = strtoimax((char *)(*pp), (char **)pp, 10);
if ((*nr == INTMAX_MIN || *nr == INTMAX_MAX)
&& errno == ERANGE) {
- return FAIL;
+ return false;
}
- return OK;
+ return true;
}
/// Get a number from a string and skip over it.
@@ -1624,10 +1624,10 @@ int getdigits_safe(char_u **pp, intmax_t *nr)
intmax_t getdigits(char_u **pp)
{
intmax_t number;
- int ret = getdigits_safe(pp, &number);
+ int ok = try_getdigits(pp, &number);
- (void)ret; // Avoid "unused variable" warning in Release build
- assert(ret == OK);
+ (void)ok; // Avoid "unused variable" warning in Release build
+ assert(ok);
return number;
}