aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/menu.c
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-01-11 12:55:38 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-01-11 17:18:39 +0100
commit04c0658024a98a0586997f0ea8af1e3f774cc83e (patch)
treecb34605b25e040a179de11dbc34cc739c7547d34 /src/nvim/menu.c
parent28e75d4c453dcf7b1d1630815036d0236cfa0034 (diff)
downloadrneovim-04c0658024a98a0586997f0ea8af1e3f774cc83e.tar.gz
rneovim-04c0658024a98a0586997f0ea8af1e3f774cc83e.tar.bz2
rneovim-04c0658024a98a0586997f0ea8af1e3f774cc83e.zip
Cleanup: Refactor getdigits().
Problem : getdigits() currently returns a long, but at most places, return value is casted (unsafely) into an int. Making casts safe would introduce a lot of fuss in the form of assertions checking for limits. Note : We cannot just change return type to int, because, at some places, legitimate long values are used. For example, in diff.c, for line numbers. Solution : Introduce new functions: - get_digits() : Gets an intmax_t from a string. - get_int_digits() : Wrapper for ints. - get_long_digits() : Wrapper for longs. And replace getdigits() invocations by the appropiate wrapper invocations.
Diffstat (limited to 'src/nvim/menu.c')
-rw-r--r--src/nvim/menu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index b31b6c1cec..dffd1f41c5 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -120,7 +120,7 @@ ex_menu (
break;
if (vim_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !vim_iswhite(*arg); ++i) {
- pri_tab[i] = getdigits(&arg);
+ pri_tab[i] = get_int_digits(&arg);
if (pri_tab[i] == 0)
pri_tab[i] = 500;
if (*arg == '.')