1
0
forked from aniani/vim

patch 9.1.0818: some global functions are only used in single files

Problem:  some global functions are only used in single files
Solution: refactor code slightly and make some more functions static
          (Yegappan Lakshmanan)

closes: #15951

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2024-10-27 21:54:11 +01:00
committed by Christian Brabandt
parent 8f1d09828a
commit a04003a929
9 changed files with 17 additions and 18 deletions

View File

@@ -953,6 +953,17 @@ get_keystroke(void)
return n;
}
// For overflow detection, add a digit safely to an int value.
static int
vim_append_digit_int(int *value, int digit)
{
int x = *value;
if (x > ((INT_MAX - digit) / 10))
return FAIL;
*value = x * 10 + digit;
return OK;
}
/*
* Get a number from the user.
* When "mouse_used" is not NULL allow using the mouse.
@@ -2824,17 +2835,6 @@ may_trigger_modechanged(void)
#endif
}
// For overflow detection, add a digit safely to an int value.
int
vim_append_digit_int(int *value, int digit)
{
int x = *value;
if (x > ((INT_MAX - digit) / 10))
return FAIL;
*value = x * 10 + digit;
return OK;
}
// For overflow detection, add a digit safely to a long value.
int
vim_append_digit_long(long *value, int digit)