Skip to content

Commit a04003a

Browse files
yegappanchrisbra
authored andcommitted
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>
1 parent 8f1d098 commit a04003a

9 files changed

Lines changed: 17 additions & 18 deletions

File tree

src/misc1.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,17 @@ get_keystroke(void)
953953
return n;
954954
}
955955

956+
// For overflow detection, add a digit safely to an int value.
957+
static int
958+
vim_append_digit_int(int *value, int digit)
959+
{
960+
int x = *value;
961+
if (x > ((INT_MAX - digit) / 10))
962+
return FAIL;
963+
*value = x * 10 + digit;
964+
return OK;
965+
}
966+
956967
/*
957968
* Get a number from the user.
958969
* When "mouse_used" is not NULL allow using the mouse.
@@ -2824,17 +2835,6 @@ may_trigger_modechanged(void)
28242835
#endif
28252836
}
28262837

2827-
// For overflow detection, add a digit safely to an int value.
2828-
int
2829-
vim_append_digit_int(int *value, int digit)
2830-
{
2831-
int x = *value;
2832-
if (x > ((INT_MAX - digit) / 10))
2833-
return FAIL;
2834-
*value = x * 10 + digit;
2835-
return OK;
2836-
}
2837-
28382838
// For overflow detection, add a digit safely to a long value.
28392839
int
28402840
vim_append_digit_long(long *value, int digit)

src/proto/misc1.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ int path_with_url(char_u *fname);
5353
dict_T *get_v_event(save_v_event_T *sve);
5454
void restore_v_event(dict_T *v_event, save_v_event_T *sve);
5555
void may_trigger_modechanged(void);
56-
int vim_append_digit_int(int *value, int digit);
5756
int vim_append_digit_long(long *value, int digit);
5857
int trim_to_int(vimlong_T x);
5958
/* vim: set ft=c : */

src/proto/typval.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ int check_for_list_or_dict_or_blob_arg(typval_T *args, int idx);
5353
int check_for_list_or_dict_or_blob_or_string_arg(typval_T *args, int idx);
5454
int check_for_opt_buffer_or_dict_arg(typval_T *args, int idx);
5555
int check_for_object_arg(typval_T *args, int idx);
56-
int tv_class_alias(typval_T *tv);
5756
int check_for_class_or_typealias_args(typval_T *args, int idx);
5857
char_u *tv_get_string(typval_T *varp);
5958
char_u *tv_get_string_strict(typval_T *varp);

src/proto/userfunc.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typva
4242
int call_simple_func(char_u *funcname, size_t len, typval_T *rettv);
4343
char_u *printable_func_name(ufunc_T *fp);
4444
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags);
45-
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);
4645
char_u *get_scriptlocal_funcname(char_u *funcname);
4746
char_u *alloc_printable_func_name(char_u *fname);
4847
char_u *save_function_name(char_u **name, int *is_global, int skip, int flags, funcdict_T *fudi);

src/proto/vim9class.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ void enum_set_internal_obj_vars(class_T *en, object_T *enval);
77
type_T *oc_member_type(class_T *cl, int is_object, char_u *name, char_u *name_end, int *member_idx);
88
type_T *oc_member_type_by_idx(class_T *cl, int is_object, int member_idx);
99
void ex_enum(exarg_T *eap);
10-
void typealias_free(typealias_T *ta);
1110
void typealias_unref(typealias_T *ta);
1211
void ex_type(exarg_T *eap);
1312
int class_object_index(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int verbose);

src/typval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ check_for_object_arg(typval_T *args, int idx)
10211021
/*
10221022
* Returns TRUE if "tv" is a type alias for a class
10231023
*/
1024-
int
1024+
static int
10251025
tv_class_alias(typval_T *tv)
10261026
{
10271027
return tv->v_type == VAR_TYPEALIAS &&

src/userfunc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static void func_clear(ufunc_T *fp, int force);
3434
static int func_free(ufunc_T *fp, int force);
3535
static char_u *untrans_function_name(char_u *name);
3636
static void handle_defer_one(funccall_T *funccal);
37+
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);
3738

3839
void
3940
func_init(void)
@@ -4266,7 +4267,7 @@ trans_function_name(
42664267
* trans_function_name() with extra arguments.
42674268
* "fdp", "partial", "type" and "ufunc" can be NULL.
42684269
*/
4269-
char_u *
4270+
static char_u *
42704271
trans_function_name_ext(
42714272
char_u **pp,
42724273
int *is_global,

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
818,
707709
/**/
708710
817,
709711
/**/

src/vim9class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,7 @@ oc_member_type_by_idx(
26462646
* Type aliases (:type)
26472647
*/
26482648

2649-
void
2649+
static void
26502650
typealias_free(typealias_T *ta)
26512651
{
26522652
// ta->ta_type is freed in clear_type_list()

0 commit comments

Comments
 (0)