diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-08-20 20:13:45 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-08-20 20:13:45 +0200 |
commit | 5843f5f37b0632e2d706abc9014bfd7d98f7b02e (patch) | |
tree | 2f1af5fd16214dfdf8edc8717e06a8b0aab81c1a /src | |
parent | 9a4a8c4d5993c6371486c895a515c2ad351e9aaa (diff) |
patch 8.1.1891: functions used in one file are globalv8.1.1891
Problem: Functions used in one file are global.
Solution: Add "static". (Yegappan Lakshmanan, closes #4840)
Diffstat (limited to 'src')
67 files changed, 162 insertions, 178 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index 17b1748df3..640032b608 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1659,7 +1659,7 @@ apply_autocmds_retval( /* * Return TRUE when there is a CursorHold autocommand defined. */ - int + static int has_cursorhold(void) { return (first_autopat[(int)(get_real_state() == NORMAL_BUSY diff --git a/src/buffer.c b/src/buffer.c index c279c263c1..78801a8121 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -27,6 +27,8 @@ #include "vim.h" +static void enter_buffer(buf_T *buf); +static void buflist_getfpos(void); static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, int ignore_case); static char_u *fname_match(regmatch_T *rmp, char_u *name, int ignore_case); #ifdef UNIX @@ -43,6 +45,10 @@ static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file); static void free_buffer(buf_T *); static void free_buffer_stuff(buf_T *buf, int free_options); static void clear_wininfo(buf_T *buf); +#if defined(FEAT_JOB_CHANNEL) \ + || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) +static int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp); +#endif #ifdef UNIX # define dev_T dev_t @@ -1705,7 +1711,7 @@ set_curbuf(buf_T *buf, int action) * Old curbuf must have been abandoned already! This also means "curbuf" may * be pointing to freed memory. */ - void + static void enter_buffer(buf_T *buf) { /* Copy buffer and window local option values. Not for a help buffer. */ @@ -2355,7 +2361,7 @@ buflist_getfile( /* * go to the last know line number for the current buffer */ - void + static void buflist_getfpos(void) { pos_T *fpos; @@ -5465,7 +5471,7 @@ restore_win_for_buf( * If found OK is returned and "wp" and "tp" are set to the window and tabpage. * If not found FAIL is returned. */ - int + static int find_win_for_buf( buf_T *buf, win_T **wp, diff --git a/src/change.c b/src/change.c index f83587d833..23c95871ee 100644 --- a/src/change.c +++ b/src/change.c @@ -666,7 +666,7 @@ changed_bytes(linenr_T lnum, colnr_T col) * Like changed_bytes() but also adjust text properties for "added" bytes. * When "added" is negative text was deleted. */ - void + static void inserted_bytes(linenr_T lnum, colnr_T col, int added UNUSED) { #ifdef FEAT_TEXT_PROP diff --git a/src/channel.c b/src/channel.c index 8b0abdc302..a023c9fd77 100644 --- a/src/channel.c +++ b/src/channel.c @@ -55,6 +55,14 @@ #endif static void channel_read(channel_T *channel, ch_part_T part, char *func); +# if defined(MSWIN) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) +static channel_T *channel_fd2channel(sock_T fd, ch_part_T *partp); +# endif +static ch_mode_T channel_get_mode(channel_T *channel, ch_part_T part); +static int channel_get_timeout(channel_T *channel, ch_part_T part); +static ch_part_T channel_part_send(channel_T *channel); +static ch_part_T channel_part_read(channel_T *channel); +static void free_job_options(jobopt_T *opt); /* Whether a redraw is needed for appending a line to a buffer. */ static int channel_need_redraw = FALSE; @@ -1175,7 +1183,7 @@ channel_set_options(channel_T *channel, jobopt_T *opt) /* * Implements ch_open(). */ - channel_T * + static channel_T * channel_open_func(typval_T *argvars) { char_u *address; @@ -1348,7 +1356,7 @@ channel_set_job(channel_T *channel, job_T *job, jobopt_T *options) /* * Set the callback for "channel"/"part" for the response with "id". */ - void + static void channel_set_req_callback( channel_T *channel, ch_part_T part, @@ -2848,7 +2856,7 @@ channel_is_open(channel_T *channel) /* * Return TRUE if "channel" has JSON or other typeahead. */ - int + static int channel_has_readahead(channel_T *channel, ch_part_T part) { ch_mode_T ch_mode = channel->ch_part[part].ch_mode; @@ -2959,7 +2967,7 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part) dict_add_number(dict, namebuf, chanpart->ch_timeout); } - void + static void channel_info(channel_T *channel, dict_T *dict) { dict_add_number(dict, "id", channel->ch_id); @@ -3067,7 +3075,7 @@ channel_close(channel_T *channel, int invoke_close_cb) /* * Close the "in" part channel "channel". */ - void + static void channel_close_in(channel_T *channel) { ch_close_part(channel, PART_IN); @@ -3676,7 +3684,7 @@ get_channel_arg(typval_T *tv, int check_open, int reading, ch_part_T part) /* * Common for ch_read() and ch_readraw(). */ - void + static void common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob) { channel_T *channel; @@ -3762,7 +3770,7 @@ theend: * Lookup the channel from the socket. Set "partp" to the fd index. * Returns NULL when the socket isn't found. */ - channel_T * + static channel_T * channel_fd2channel(sock_T fd, ch_part_T *partp) { channel_T *channel; @@ -4092,7 +4100,7 @@ send_common( /* * common for "ch_evalexpr()" and "ch_sendexpr()" */ - void + static void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) { char_u *text; @@ -4154,7 +4162,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) /* * common for "ch_evalraw()" and "ch_sendraw()" */ - void + static void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) { char_u buf[NUMBUFLEN]; @@ -4540,7 +4548,7 @@ set_ref_in_channel(int copyID) /* * Return the "part" to write to for "channel". */ - ch_part_T + static ch_part_T channel_part_send(channel_T *channel) { if (channel->CH_SOCK_FD == INVALID_FD) @@ -4551,7 +4559,7 @@ channel_part_send(channel_T *channel) /* * Return the default "part" to read from for "channel". */ - ch_part_T + static ch_part_T channel_part_read(channel_T *channel) { if (channel->CH_SOCK_FD == INVALID_FD) @@ -4563,7 +4571,7 @@ channel_part_read(channel_T *channel) * Return the mode of "channel"/"part" * If "channel" is invalid returns MODE_JSON. */ - ch_mode_T + static ch_mode_T channel_get_mode(channel_T *channel, ch_part_T part) { if (channel == NULL) @@ -4574,7 +4582,7 @@ channel_get_mode(channel_T *channel, ch_part_T part) /* * Return the timeout of "channel"/"part" */ - int + static int channel_get_timeout(channel_T *channel, ch_part_T part) { return channel->ch_part[part].ch_timeout; @@ -4638,7 +4646,7 @@ clear_job_options(jobopt_T *opt) /* * Free any members of a jobopt_T. */ - void + static void free_job_options(jobopt_T *opt) { if (opt->jo_callback.cb_partial != NULL) @@ -5309,7 +5317,7 @@ job_free(job_T *job) } } -job_T *jobs_to_free = NULL; +static job_T *jobs_to_free = NULL; /* * Put "job" in a list to be freed later, when it's no longer referenced. diff --git a/src/charset.c b/src/charset.c index 12e10e1989..50ca617dc2 100644 --- a/src/charset.c +++ b/src/charset.c @@ -35,6 +35,8 @@ static char_u g_chartab[256]; #define CT_ID_CHAR 0x20 /* flag: set for ID chars */ #define CT_FNAME_CHAR 0x40 /* flag: set for file name chars */ +static int in_win_border(win_T *wp, colnr_T vcol); + /* * Fill g_chartab[]. Also fills curbuf->b_chartab[] with flags for keyword * characters for current buffer. @@ -1174,7 +1176,7 @@ win_nolbr_chartabsize( * Return TRUE if virtual column "vcol" is in the rightmost column of window * "wp". */ - int + static int in_win_border(win_T *wp, colnr_T vcol) { int width1; /* width of first line (after line number) */ diff --git a/src/dict.c b/src/dict.c index 1097e58cdc..b2c3fbcdee 100644 --- a/src/dict.c +++ b/src/dict.c @@ -957,7 +957,7 @@ dict_equal( * "what" == 1: list of values * "what" == 2: list of items */ - void + static void dict_list(typval_T *argvars, typval_T *rettv, int what) { list_T *l2; diff --git a/src/digraph.c b/src/digraph.c index 5b56095378..8a3bf12b3b 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -2180,7 +2180,7 @@ listdigraphs(int use_headers) wrong, in which case we messed up ScreenLines */ } -struct dg_header_entry { +static struct dg_header_entry { int dg_start; char *dg_header; } header_table[] = { diff --git a/src/eval.c b/src/eval.c index bff5664ef2..3f2a33a98a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -248,7 +248,9 @@ static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate); static int free_unref_items(int copyID); static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate); static int get_env_len(char_u **arg); -static char_u * make_expanded_name(char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end); +static int get_name_len(char_u **arg, char_u **alias, int evaluate, int verbose); +static char_u *make_expanded_name(char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end); +static int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload); static void check_vars(char_u *name, int len); static typval_T *alloc_string_tv(char_u *string); static void delete_var(hashtab_T *ht, hashitem_T *hi); @@ -6924,7 +6926,7 @@ get_id_len(char_u **arg) * If the name contains 'magic' {}'s, expand them and return the * expanded name in an allocated string via 'alias' - caller must free. */ - int + static int get_name_len( char_u **arg, char_u **alias, @@ -7453,7 +7455,7 @@ set_cmdarg(exarg_T *eap, char_u *oldarg) * Get the value of internal variable "name". * Return OK or FAIL. If OK is returned "rettv" must be cleared. */ - int + static int get_var_tv( char_u *name, int len, /* length of "name" */ @@ -8014,7 +8016,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf) * Turn a typeval into a string. Similar to tv_get_string_buf() but uses * string() on Dict, List, etc. */ - char_u * + static char_u * tv_stringify(typval_T *varp, char_u *buf) { if (varp->v_type == VAR_LIST diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 77e925d4b5..77d39434f5 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -20,7 +20,7 @@ static int linelen(int *has_tab); static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out); - +static int not_writing(void); static int check_readonly(int *forceit, buf_T *buf); static void delbuf_msg(char_u *name); static int help_compare(const void *s1, const void *s2); @@ -2456,7 +2456,7 @@ do_wqall(exarg_T *eap) * Check the 'write' option. * Return TRUE and give a message when it's not set. */ - int + static int not_writing(void) { if (p_write) diff --git a/src/ex_eval.c b/src/ex_eval.c index 25a8684591..f1a8b97fcc 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -839,7 +839,7 @@ report_make_pending(int pending, void *value) * If something pending in a finally clause is resumed at the ":endtry", report * it if required by the 'verbose' option or when debugging. */ - void + static void report_resume_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) @@ -856,7 +856,7 @@ report_resume_pending(int pending, void *value) * If something pending in a finally clause is discarded, report it if required * by the 'verbose' option or when debugging. */ - void + static void report_discard_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) diff --git a/src/fileio.c b/src/fileio.c index e07b908671..606359ade9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -111,7 +111,7 @@ static int get_mac_fio_flags(char_u *ptr); #endif static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name"); - void + static void filemess( buf_T *buf, char_u *name, diff --git a/src/findfile.c b/src/findfile.c index 39e215255d..75d4a541d0 100644 --- a/src/findfile.c +++ b/src/findfile.c @@ -188,6 +188,7 @@ static int ff_check_visited(ff_visited_T **, char_u *, char_u *); #else static int ff_check_visited(ff_visited_T **, char_u *); #endif +static void vim_findfile_free_visited(void *search_ctx_arg); static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); static void ff_free_visited_list(ff_visited_T *vl); static ff_visited_list_hdr_T* ff_get_visited_list(char_u *, ff_visited_list_hdr_T **list_headp); @@ -1186,7 +1187,7 @@ fail: * Free the list of lists of visited files and directories * Can handle it if the passed search_context is NULL; */ - void + static void vim_findfile_free_visited(void *search_ctx_arg) { ff_search_ctx_T *search_ctx; diff --git a/src/getchar.c b/src/getchar.c index b0e72f58f2..2fb8438e85 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -91,7 +91,9 @@ static int last_recorded_len = 0; /* number of last recorded chars */ static int read_readbuf(buffheader_T *buf, int advance); static void init_typebuf(void); static void may_sync_undo(void); +static void free_typebuf(void); static void closescript(void); +static void updatescript(int c); static int vgetorpeek(int); static int inchar(char_u *buf, int maxlen, long wait_time); @@ -1263,7 +1265,7 @@ may_sync_undo(void) * Make "typebuf" empty and allocate new buffers. * Returns FAIL when out of memory. */ - int + static int alloc_typebuf(void) { typebuf.tb_buf = alloc(TYPELEN_INIT); @@ -1287,7 +1289,7 @@ alloc_typebuf(void) /* * Free the buffers of "typebuf". */ - void + static void free_typebuf(void) { if (typebuf.tb_buf == typebuf_init) @@ -1511,7 +1513,7 @@ before_blocking(void) * All the changed memfiles are synced if c == 0 or when the number of typed * characters reaches 'updatecount' and 'updatecount' is non-zero. */ - void + static void updatescript(int c) { static int count = 0; @@ -17,10 +17,13 @@ gui_T gui; static void set_guifontwide(char_u *font_name); #endif static void gui_check_pos(void); +static void gui_reset_scroll_region(void); static void gui_outstr(char_u *, int); static int gui_screenchar(int off, int flags, guicolor_T fg, guicolor_T bg, int back); +static int gui_outstr_nowrap(char_u *s, int len, int flags, guicolor_T fg, guicolor_T bg, int back); static void gui_delete_lines(int row, int count); static void gui_insert_lines(int row, int count); +static int gui_xy2colrow(int x, int y, int *colp); #if defined(FEAT_GUI_TABLINE) || defined(PROTO) static int gui_has_tabline(void); #endif @@ -1050,7 +1053,7 @@ gui_get_wide_font(void) return OK; } - void + static void gui_set_cursor(int row, int col) { gui.row = row; @@ -1713,7 +1716,7 @@ gui_new_shellsize(void) /* * Make scroll region cover whole screen. */ - void + static void gui_reset_scroll_region(void) { gui.scroll_region_top = 0; @@ -1722,7 +1725,7 @@ gui_reset_scroll_region(void) gui.scroll_region_right = gui.num_cols - 1; } - void + static void gui_start_highlight(int mask) { if (mask > HL_ALL) /* highlight code */ @@ -2227,7 +2230,7 @@ gui_screenstr( * Returns OK, unless "back" is non-zero and using the bold trick, then return * FAIL (the caller should start drawing "back" chars back). */ - int + static int gui_outstr_nowrap( char_u *s, int len, @@ -3380,7 +3383,7 @@ button_set: * Corrects for multi-byte character. * returns column in "*colp" and row as return value; */ - int + static int gui_xy2colrow(int x, int y, int *colp) { int col = check_col(X_2_COL(x)); diff --git a/src/indent.c b/src/indent.c index 8499b81347..2ae580a97e 100644 --- a/src/indent.c +++ b/src/indent.c @@ -15,6 +15,9 @@ #if defined(FEAT_CINDENT) || defined(FEAT_SMARTINDENT) +static int cin_iscase(char_u *s, int strict); +static int cin_isscopedecl(char_u *s); + /* * Return TRUE if the string "line" starts with a word from 'cinwords'. */ @@ -408,7 +411,7 @@ cin_islabel_skip(char_u **s) * Recognize a label: "label:". * Note: curwin->w_cursor must be where we are looking for the label. */ - int + static int cin_islabel(void) // XXX { char_u *s; @@ -507,7 +510,7 @@ cin_isinit(void) /* * Recognize a switch label: "case .*:" or "default:". */ - int + static int cin_iscase( char_u *s, int strict) // Allow relaxed check of case statement for JS @@ -560,7 +563,7 @@ cin_isdefault(char_u *s) /* * Recognize a "public/private/protected" scope declaration label. */ - int + static int cin_isscopedecl(char_u *s) { int i; diff --git a/src/json.c b/src/json.c index 2a5b5e4828..cca6f7044f 100644 --- a/src/json.c +++ b/src/json.c @@ -1056,7 +1056,7 @@ theend: * "options" can be JSON_JS or zero; * Return FAIL if not the whole message was consumed. */ - int + static int json_decode_all(js_read_T *reader, typval_T *res, int options) { int ret; diff --git a/src/list.c b/src/list.c index fc348672b4..a0c710df66 100644 --- a/src/list.c +++ b/src/list.c @@ -53,7 +53,7 @@ list_rem_watch(list_T *l, listwatch_T *lwrem) * Just before removing an item from a list: advance watchers to the next * item. */ - void + static void list_fix_watch(list_T *l, listitem_T *item) { listwatch_T *lw; diff --git a/src/mark.c b/src/mark.c index f55365f1fb..8 |