To: vim_dev@googlegroups.com Subject: Patch 8.1.2021 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2021 Problem: Some global functions can be local to the file. Solution: Add "static". (Yegappan Lakshmanan, closes #4917) Files: src/ex_cmds2.c, src/filepath.c, src/hangulin.c, src/mbyte.c, src/misc1.c, src/os_unix.c, src/proto/ex_cmds2.pro, src/proto/filepath.pro, src/proto/hangulin.pro, src/proto/mbyte.pro, src/proto/misc1.pro, src/proto/os_unix.pro, src/proto/terminal.pro, src/proto/undo.pro, src/pty.c, src/terminal.c, src/undo.c *** ../vim-8.1.2020/src/ex_cmds2.c 2019-09-05 22:33:23.268963478 +0200 --- src/ex_cmds2.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 260,266 **** /* * Find a timer by ID. Returns NULL if not found; */ ! timer_T * find_timer(long id) { timer_T *timer; --- 260,266 ---- /* * Find a timer by ID. Returns NULL if not found; */ ! static timer_T * find_timer(long id) { timer_T *timer; *************** *** 291,297 **** } } ! void stop_all_timers(void) { timer_T *timer; --- 291,297 ---- } } ! static void stop_all_timers(void) { timer_T *timer; *************** *** 304,310 **** } } ! void add_timer_info(typval_T *rettv, timer_T *timer) { list_T *list = rettv->vval.v_list; --- 304,310 ---- } } ! static void add_timer_info(typval_T *rettv, timer_T *timer) { list_T *list = rettv->vval.v_list; *************** *** 338,344 **** } } ! void add_timer_info_all(typval_T *rettv) { timer_T *timer; --- 338,344 ---- } } ! static void add_timer_info_all(typval_T *rettv) { timer_T *timer; *** ../vim-8.1.2020/src/filepath.c 2019-09-05 22:33:23.264963492 +0200 --- src/filepath.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 793,799 **** rettv->vval.v_number = filewritable(tv_get_string(&argvars[0])); } ! void findfilendir( typval_T *argvars UNUSED, typval_T *rettv, --- 793,799 ---- rettv->vval.v_number = filewritable(tv_get_string(&argvars[0])); } ! static void findfilendir( typval_T *argvars UNUSED, typval_T *rettv, *** ../vim-8.1.2020/src/hangulin.c 2019-08-24 21:53:12.000023828 +0200 --- src/hangulin.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 809,815 **** return len; } ! void hangul_input_clear(void) { sp = 0; --- 809,815 ---- return len; } ! static void hangul_input_clear(void) { sp = 0; *** ../vim-8.1.2020/src/mbyte.c 2019-09-07 16:07:43.961413385 +0200 --- src/mbyte.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 144,149 **** --- 144,150 ---- static int dbcs_char2cells(int c); static int dbcs_ptr2cells_len(char_u *p, int size); static int dbcs_ptr2char(char_u *p); + static int dbcs_head_off(char_u *base, char_u *p); /* * Lookup table to quickly get the length in bytes of a UTF-8 character from *************** *** 3778,3784 **** return 0; } ! int dbcs_head_off(char_u *base, char_u *p) { char_u *q; --- 3779,3785 ---- return 0; } ! static int dbcs_head_off(char_u *base, char_u *p) { char_u *q; *** ../vim-8.1.2020/src/misc1.c 2019-09-04 20:59:10.483410013 +0200 --- src/misc1.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 2761,2767 **** # if defined(FEAT_EVAL) || defined(PROTO) ! void get_cmd_output_as_rettv( typval_T *argvars, typval_T *rettv, --- 2761,2767 ---- # if defined(FEAT_EVAL) || defined(PROTO) ! static void get_cmd_output_as_rettv( typval_T *argvars, typval_T *rettv, *** ../vim-8.1.2020/src/os_unix.c 2019-09-04 20:59:10.491409987 +0200 --- src/os_unix.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 4276,4282 **** /* * Send SIGINT to a child process if "c" is an interrupt character. */ ! void may_send_sigint(int c UNUSED, pid_t pid UNUSED, pid_t wpid UNUSED) { # ifdef SIGINT --- 4276,4282 ---- /* * Send SIGINT to a child process if "c" is an interrupt character. */ ! static void may_send_sigint(int c UNUSED, pid_t pid UNUSED, pid_t wpid UNUSED) { # ifdef SIGINT *** ../vim-8.1.2020/src/proto/ex_cmds2.pro 2019-09-05 22:33:23.268963478 +0200 --- src/proto/ex_cmds2.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 2,12 **** long proftime_time_left(proftime_T *due, proftime_T *now); timer_T *create_timer(long msec, int repeat); long check_due_timer(void); - timer_T *find_timer(long id); void stop_timer(timer_T *timer); - void stop_all_timers(void); - void add_timer_info(typval_T *rettv, timer_T *timer); - void add_timer_info_all(typval_T *rettv); int set_ref_in_timer(int copyID); void timer_free_all(void); void f_timer_info(typval_T *argvars, typval_T *rettv); --- 2,8 ---- *** ../vim-8.1.2020/src/proto/filepath.pro 2019-09-05 22:33:23.264963492 +0200 --- src/proto/filepath.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 6,12 **** void f_exepath(typval_T *argvars, typval_T *rettv); void f_filereadable(typval_T *argvars, typval_T *rettv); void f_filewritable(typval_T *argvars, typval_T *rettv); - void findfilendir(typval_T *argvars, typval_T *rettv, int find_what); void f_finddir(typval_T *argvars, typval_T *rettv); void f_findfile(typval_T *argvars, typval_T *rettv); void f_fnamemodify(typval_T *argvars, typval_T *rettv); --- 6,11 ---- *** ../vim-8.1.2020/src/proto/hangulin.pro 2018-05-17 13:52:38.000000000 +0200 --- src/proto/hangulin.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 5,11 **** void hangul_input_state_toggle(void); void hangul_keyboard_set(void); int hangul_input_process(char_u *s, int len); - void hangul_input_clear(void); char_u *hangul_string_convert(char_u *buf, int *p_len); char_u *hangul_composing_buffer_get(int *p_len); /* vim: set ft=c : */ --- 5,10 ---- *** ../vim-8.1.2020/src/proto/mbyte.pro 2019-09-07 15:03:00.657670286 +0200 --- src/proto/mbyte.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 50,56 **** int mb_strnicmp(char_u *s1, char_u *s2, size_t nn); void show_utf8(void); int latin_head_off(char_u *base, char_u *p); - int dbcs_head_off(char_u *base, char_u *p); int dbcs_screen_head_off(char_u *base, char_u *p); int utf_head_off(char_u *base, char_u *p); void mb_copy_char(char_u **fp, char_u **tp); --- 50,55 ---- *** ../vim-8.1.2020/src/proto/misc1.pro 2019-09-04 20:59:10.483410013 +0200 --- src/proto/misc1.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 48,54 **** void line_breakcheck(void); void fast_breakcheck(void); char_u *get_cmd_output(char_u *cmd, char_u *infile, int flags, int *ret_len); - void get_cmd_output_as_rettv(typval_T *argvars, typval_T *rettv, int retlist); void f_system(typval_T *argvars, typval_T *rettv); void f_systemlist(typval_T *argvars, typval_T *rettv); int goto_im(void); --- 48,53 ---- *** ../vim-8.1.2020/src/proto/os_unix.pro 2019-06-14 21:36:51.018437479 +0200 --- src/proto/os_unix.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 59,65 **** int mch_report_winsize(int fd, int rows, int cols); void mch_set_shellsize(void); void mch_new_shellsize(void); - void may_send_sigint(int c, pid_t pid, pid_t wpid); int mch_call_shell(char_u *cmd, int options); void mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal); char *mch_job_status(job_T *job); --- 59,64 ---- *** ../vim-8.1.2020/src/proto/terminal.pro 2019-04-17 18:24:32.010143188 +0200 --- src/proto/terminal.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 56,62 **** void f_term_wait(typval_T *argvars, typval_T *rettv); void term_send_eof(channel_T *ch); job_T *term_getjob(term_T *term); - void term_free_conpty(term_T *term); int use_conpty(void); int terminal_enabled(void); /* vim: set ft=c : */ --- 56,61 ---- *** ../vim-8.1.2020/src/proto/undo.pro 2019-09-04 17:48:11.712877356 +0200 --- src/proto/undo.pro 2019-09-10 21:25:26.236058035 +0200 *************** *** 7,13 **** int undo_allowed(void); int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload); void u_compute_hash(char_u *hash); - char_u *u_get_undo_file_name(char_u *buf_ffname, int reading); void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash); void u_read_undo(char_u *name, char_u *hash, char_u *orig_name); void u_undo(int count); --- 7,12 ---- *************** *** 27,33 **** int anyBufIsChanged(void); int bufIsChangedNotTerm(buf_T *buf); int curbufIsChanged(void); - void u_eval_tree(u_header_T *first_uhp, list_T *list); void f_undofile(typval_T *argvars, typval_T *rettv); void f_undotree(typval_T *argvars, typval_T *rettv); /* vim: set ft=c : */ --- 26,31 ---- *** ../vim-8.1.2020/src/pty.c 2019-04-28 18:39:59.559845361 +0200 --- src/pty.c 2019-09-10 21:25:26.236058035 +0200 *************** *** 347,353 **** #define PTY_DONE #ifdef _IBMR2 ! int aixhack = -1; #endif int --- 347,353 ---- #define PTY_DONE #ifdef _IBMR2 ! static int aixhack = -1; #endif int *** ../vim-8.1.2020/src/terminal.c 2019-09-08 20:55:03.146072987 +0200 --- src/terminal.c 2019-09-10 21:25:26.240058018 +0200 *************** *** 875,881 **** // Terminals that need to be freed soon. ! term_T *terminals_to_free = NULL; /* * Free a terminal and everything it refers to. --- 875,881 ---- // Terminals that need to be freed soon. ! static term_T *terminals_to_free = NULL; /* * Free a terminal and everything it refers to. *************** *** 6024,6030 **** pResizePseudoConsole(term->tl_conpty, consize); } ! void term_free_conpty(term_T *term) { if (term->tl_siex.lpAttributeList != NULL) --- 6024,6030 ---- pResizePseudoConsole(term->tl_conpty, consize); } ! static void term_free_conpty(term_T *term) { if (term->tl_siex.lpAttributeList != NULL) *** ../vim-8.1.2020/src/undo.c 2019-09-08 15:27:17.552004765 +0200 --- src/undo.c 2019-09-10 21:25:26.240058018 +0200 *************** *** 775,781 **** * When "reading" is FALSE use the first name where the directory exists. * Returns NULL when there is no place to write or no file to read. */ ! char_u * u_get_undo_file_name(char_u *buf_ffname, int reading) { char_u *dirp; --- 775,781 ---- * When "reading" is FALSE use the first name where the directory exists. * Returns NULL when there is no place to write or no file to read. */ ! static char_u * u_get_undo_file_name(char_u *buf_ffname, int reading) { char_u *dirp; *************** *** 3590,3596 **** * For undotree(): Append the list of undo blocks at "first_uhp" to "list". * Recursive. */ ! void u_eval_tree(u_header_T *first_uhp, list_T *list) { u_header_T *uhp = first_uhp; --- 3590,3596 ---- * For undotree(): Append the list of undo blocks at "first_uhp" to "list". * Recursive. */ ! static void u_eval_tree(u_header_T *first_uhp, list_T *list) { u_header_T *uhp = first_uhp; *** ../vim-8.1.2020/src/version.c 2019-09-10 21:22:54.876629189 +0200 --- src/version.c 2019-09-10 21:26:42.555770055 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 2021, /**/ -- Google is kind of like Dr. Who's Tardis; it's weirder on the inside than on the outside... /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///