mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
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:
parent
8f1d09828a
commit
a04003a929
22
src/misc1.c
22
src/misc1.c
@ -953,6 +953,17 @@ get_keystroke(void)
|
|||||||
return n;
|
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.
|
* Get a number from the user.
|
||||||
* When "mouse_used" is not NULL allow using the mouse.
|
* When "mouse_used" is not NULL allow using the mouse.
|
||||||
@ -2824,17 +2835,6 @@ may_trigger_modechanged(void)
|
|||||||
#endif
|
#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.
|
// For overflow detection, add a digit safely to a long value.
|
||||||
int
|
int
|
||||||
vim_append_digit_long(long *value, int digit)
|
vim_append_digit_long(long *value, int digit)
|
||||||
|
@ -53,7 +53,6 @@ int path_with_url(char_u *fname);
|
|||||||
dict_T *get_v_event(save_v_event_T *sve);
|
dict_T *get_v_event(save_v_event_T *sve);
|
||||||
void restore_v_event(dict_T *v_event, save_v_event_T *sve);
|
void restore_v_event(dict_T *v_event, save_v_event_T *sve);
|
||||||
void may_trigger_modechanged(void);
|
void may_trigger_modechanged(void);
|
||||||
int vim_append_digit_int(int *value, int digit);
|
|
||||||
int vim_append_digit_long(long *value, int digit);
|
int vim_append_digit_long(long *value, int digit);
|
||||||
int trim_to_int(vimlong_T x);
|
int trim_to_int(vimlong_T x);
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@ -53,7 +53,6 @@ int check_for_list_or_dict_or_blob_arg(typval_T *args, int idx);
|
|||||||
int check_for_list_or_dict_or_blob_or_string_arg(typval_T *args, int idx);
|
int check_for_list_or_dict_or_blob_or_string_arg(typval_T *args, int idx);
|
||||||
int check_for_opt_buffer_or_dict_arg(typval_T *args, int idx);
|
int check_for_opt_buffer_or_dict_arg(typval_T *args, int idx);
|
||||||
int check_for_object_arg(typval_T *args, int idx);
|
int check_for_object_arg(typval_T *args, int idx);
|
||||||
int tv_class_alias(typval_T *tv);
|
|
||||||
int check_for_class_or_typealias_args(typval_T *args, int idx);
|
int check_for_class_or_typealias_args(typval_T *args, int idx);
|
||||||
char_u *tv_get_string(typval_T *varp);
|
char_u *tv_get_string(typval_T *varp);
|
||||||
char_u *tv_get_string_strict(typval_T *varp);
|
char_u *tv_get_string_strict(typval_T *varp);
|
||||||
|
@ -42,7 +42,6 @@ int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typva
|
|||||||
int call_simple_func(char_u *funcname, size_t len, typval_T *rettv);
|
int call_simple_func(char_u *funcname, size_t len, typval_T *rettv);
|
||||||
char_u *printable_func_name(ufunc_T *fp);
|
char_u *printable_func_name(ufunc_T *fp);
|
||||||
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags);
|
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags);
|
||||||
char_u *trans_function_name_ext(char_u **pp, int *is_global, int skip, int flags, funcdict_T *fdp, partial_T **partial, type_T **type, ufunc_T **ufunc);
|
|
||||||
char_u *get_scriptlocal_funcname(char_u *funcname);
|
char_u *get_scriptlocal_funcname(char_u *funcname);
|
||||||
char_u *alloc_printable_func_name(char_u *fname);
|
char_u *alloc_printable_func_name(char_u *fname);
|
||||||
char_u *save_function_name(char_u **name, int *is_global, int skip, int flags, funcdict_T *fudi);
|
char_u *save_function_name(char_u **name, int *is_global, int skip, int flags, funcdict_T *fudi);
|
||||||
|
@ -7,7 +7,6 @@ void enum_set_internal_obj_vars(class_T *en, object_T *enval);
|
|||||||
type_T *oc_member_type(class_T *cl, int is_object, char_u *name, char_u *name_end, int *member_idx);
|
type_T *oc_member_type(class_T *cl, int is_object, char_u *name, char_u *name_end, int *member_idx);
|
||||||
type_T *oc_member_type_by_idx(class_T *cl, int is_object, int member_idx);
|
type_T *oc_member_type_by_idx(class_T *cl, int is_object, int member_idx);
|
||||||
void ex_enum(exarg_T *eap);
|
void ex_enum(exarg_T *eap);
|
||||||
void typealias_free(typealias_T *ta);
|
|
||||||
void typealias_unref(typealias_T *ta);
|
void typealias_unref(typealias_T *ta);
|
||||||
void ex_type(exarg_T *eap);
|
void ex_type(exarg_T *eap);
|
||||||
int class_object_index(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose);
|
int class_object_index(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose);
|
||||||
|
@ -1021,7 +1021,7 @@ check_for_object_arg(typval_T *args, int idx)
|
|||||||
/*
|
/*
|
||||||
* Returns TRUE if "tv" is a type alias for a class
|
* Returns TRUE if "tv" is a type alias for a class
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
tv_class_alias(typval_T *tv)
|
tv_class_alias(typval_T *tv)
|
||||||
{
|
{
|
||||||
return tv->v_type == VAR_TYPEALIAS &&
|
return tv->v_type == VAR_TYPEALIAS &&
|
||||||
|
@ -34,6 +34,7 @@ static void func_clear(ufunc_T *fp, int force);
|
|||||||
static int func_free(ufunc_T *fp, int force);
|
static int func_free(ufunc_T *fp, int force);
|
||||||
static char_u *untrans_function_name(char_u *name);
|
static char_u *untrans_function_name(char_u *name);
|
||||||
static void handle_defer_one(funccall_T *funccal);
|
static void handle_defer_one(funccall_T *funccal);
|
||||||
|
static char_u *trans_function_name_ext(char_u **pp, int *is_global, int skip, int flags, funcdict_T *fdp, partial_T **partial, type_T **type, ufunc_T **ufunc);
|
||||||
|
|
||||||
void
|
void
|
||||||
func_init(void)
|
func_init(void)
|
||||||
@ -4266,7 +4267,7 @@ trans_function_name(
|
|||||||
* trans_function_name() with extra arguments.
|
* trans_function_name() with extra arguments.
|
||||||
* "fdp", "partial", "type" and "ufunc" can be NULL.
|
* "fdp", "partial", "type" and "ufunc" can be NULL.
|
||||||
*/
|
*/
|
||||||
char_u *
|
static char_u *
|
||||||
trans_function_name_ext(
|
trans_function_name_ext(
|
||||||
char_u **pp,
|
char_u **pp,
|
||||||
int *is_global,
|
int *is_global,
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
818,
|
||||||
/**/
|
/**/
|
||||||
817,
|
817,
|
||||||
/**/
|
/**/
|
||||||
|
@ -2646,7 +2646,7 @@ oc_member_type_by_idx(
|
|||||||
* Type aliases (:type)
|
* Type aliases (:type)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
static void
|
||||||
typealias_free(typealias_T *ta)
|
typealias_free(typealias_T *ta)
|
||||||
{
|
{
|
||||||
// ta->ta_type is freed in clear_type_list()
|
// ta->ta_type is freed in clear_type_list()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user