diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 2460119123..83f81309e0 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -1566,7 +1566,7 @@ bool has_event(event_T event) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT /// Return true when there is a CursorHold/CursorHoldI autocommand defined for /// the current mode. -bool has_cursorhold(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT +static bool has_cursorhold(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT { return has_event((get_real_state() == MODE_NORMAL_BUSY ? EVENT_CURSORHOLD : EVENT_CURSORHOLDI)); } diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c2e26e5f3d..3f88064ca8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1683,7 +1683,7 @@ void set_curbuf(buf_T *buf, int action, bool update_jumplist) /// Enter a new current buffer. /// Old curbuf must have been abandoned already! This also means "curbuf" may /// be pointing to freed memory. -void enter_buffer(buf_T *buf) +static void enter_buffer(buf_T *buf) { // when closing the current buffer stop Visual mode if (VIsual_active @@ -2207,7 +2207,7 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit) } /// Go to the last known line number for the current buffer. -void buflist_getfpos(void) +static void buflist_getfpos(void) { pos_T *fpos = &buflist_findfmark(curbuf)->mark; diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index f32123e686..143335b5b0 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1791,7 +1791,7 @@ void digraph_getlist_common(bool list_all, typval_T *rettv) } } -struct dg_header_entry { +static struct dg_header_entry { int dg_start; const char *dg_header; } header_table[] = { diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index f9cf245e50..8a44b180da 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -190,7 +190,7 @@ void tv_list_watch_remove(list_T *const l, listwatch_T *const lwrem) /// /// @param[out] l List from which item is removed. /// @param[in] item List item being removed. -void tv_list_watch_fix(list_T *const l, const listitem_T *const item) +static void tv_list_watch_fix(list_T *const l, const listitem_T *const item) FUNC_ATTR_NONNULL_ALL { for (listwatch_T *lw = l->lv_watch; lw != NULL; lw = lw->lw_next) { diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 36cca6cf22..fcd5fcdd9e 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2144,7 +2144,7 @@ void do_wqall(exarg_T *eap) /// Check the 'write' option. /// /// @return true and give a message when it's not st. -bool not_writing(void) +static bool not_writing(void) { if (p_write) { return false; diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 18c691d076..424ee07779 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -799,7 +799,7 @@ void 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 report_resume_pending(int pending, void *value) +static void report_resume_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) { if (debug_break_level <= 0) { @@ -814,7 +814,7 @@ void 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 report_discard_pending(int pending, void *value) +static void report_discard_pending(int pending, void *value) { if (p_verbose >= 14 || debug_break_level > 0) { if (debug_break_level <= 0) { diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index c882777f1c..3c9290c308 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -1031,7 +1031,7 @@ fail: /// Free the list of lists of visited files and directories /// Can handle it if the passed search_context is NULL; -void vim_findfile_free_visited(void *search_ctx_arg) +static void vim_findfile_free_visited(void *search_ctx_arg) { if (search_ctx_arg == NULL) { return; diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index c945d878fc..28338e026e 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1282,7 +1282,7 @@ void may_sync_undo(void) } /// Make "typebuf" empty and allocate new buffers. -void alloc_typebuf(void) +static void alloc_typebuf(void) { typebuf.tb_buf = xmalloc(TYPELEN_INIT); typebuf.tb_noremap = xmalloc(TYPELEN_INIT); @@ -1298,7 +1298,7 @@ void alloc_typebuf(void) } /// Free the buffers of "typebuf". -void free_typebuf(void) +static void free_typebuf(void) { if (typebuf.tb_buf == typebuf_init) { internal_error("Free typebuf 1"); diff --git a/src/nvim/indent.c b/src/nvim/indent.c index e1acfc34ef..70d83cea2e 100644 --- a/src/nvim/indent.c +++ b/src/nvim/indent.c @@ -335,7 +335,7 @@ int get_sw_value(buf_T *buf) } /// Idem, using "pos". -int get_sw_value_pos(buf_T *buf, pos_T *pos, bool left) +static int get_sw_value_pos(buf_T *buf, pos_T *pos, bool left) { pos_T save_cursor = curwin->w_cursor; diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 89eac1e5d2..345d1a7720 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -355,7 +355,7 @@ static bool cin_islabel_skip(const char **s) // Recognize a label: "label:". // Note: curwin->w_cursor must be where we are looking for the label. -bool cin_islabel(void) // XXX +static bool cin_islabel(void) // XXX { const char *s = cin_skipcomment(get_cursor_line_ptr()); @@ -454,7 +454,7 @@ static int cin_isinit(void) /// Recognize a switch label: "case .*:" or "default:". /// /// @param strict Allow relaxed check of case statement for JS -bool cin_iscase(const char *s, bool strict) +static bool cin_iscase(const char *s, bool strict) { s = cin_skipcomment(s); if (cin_starts_with(s, "case")) { @@ -500,7 +500,7 @@ static int cin_isdefault(const char *s) } /// Recognize a scope declaration label set in 'cinscopedecls'. -bool cin_isscopedecl(const char *p) +static bool cin_isscopedecl(const char *p) { const char *s = cin_skipcomment(p); diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 5762e43e94..d465b3e70f 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -1090,7 +1090,7 @@ char *get_menu_names(expand_T *xp, int idx) /// /// @param name may be modified. /// @return start of the next element -char *menu_name_skip(char *const name) +static char *menu_name_skip(char *const name) { char *p; diff --git a/src/nvim/message.c b/src/nvim/message.c index 5c96fb9f73..94faab771b 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -662,7 +662,7 @@ void msg_source(int hl_id) /// If "emsg_off" is set: no error messages at the moment. /// If "msg" is in 'debug': do error message but without side effects. /// If "emsg_skip" is set: never do error messages. -int emsg_not_now(void) +static int emsg_not_now(void) { if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL && vim_strchr(p_debug, 't') == NULL) @@ -3045,7 +3045,7 @@ static bool do_more_prompt(int typed_char) return retval; } -void msg_moremsg(bool full) +static void msg_moremsg(bool full) { int attr = hl_combine_attr(HL_ATTR(HLF_MSG), HL_ATTR(HLF_M)); grid_line_start(&msg_grid_adj, Rows - 1); @@ -3739,7 +3739,7 @@ static void copy_confirm_hotkeys(const char *buttons, int default_button_idx, } /// Display the ":confirm" message. Also called when screen resized. -void display_confirm_msg(void) +static void display_confirm_msg(void) { // Avoid that 'q' at the more prompt truncates the message here. confirm_msg_used++; diff --git a/src/nvim/option.c b/src/nvim/option.c index 9f51d28b33..0d62e705a2 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -4916,7 +4916,7 @@ void copy_winopt(winopt_T *from, winopt_T *to) } /// Check string options in a window for a NULL value. -void check_win_options(win_T *win) +static void check_win_options(win_T *win) { check_winopt(&win->w_onebuf_opt); check_winopt(&win->w_allbuf_opt); diff --git a/src/nvim/profile.c b/src/nvim/profile.c index 627f06c9ce..9462f5b285 100644 --- a/src/nvim/profile.c +++ b/src/nvim/profile.c @@ -171,7 +171,7 @@ proftime_T profile_self(proftime_T self, proftime_T total, proftime_T children) /// Gets the current waittime. /// /// @return the current waittime -proftime_T profile_get_wait(void) FUNC_ATTR_PURE +static proftime_T profile_get_wait(void) FUNC_ATTR_PURE { return prof_wait_time; } @@ -194,7 +194,7 @@ proftime_T profile_sub_wait(proftime_T tm, proftime_T tma) FUNC_ATTR_PURE /// Checks if time `tm1` is equal to `tm2`. /// /// @return true if `tm1` == `tm2` -bool profile_equal(proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST +static bool profile_equal(proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST { return tm1 == tm2; } diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 8d791a4c38..e878fe2709 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2991,7 +2991,7 @@ void u_clearallandblockfree(buf_T *buf) } /// Save the line "lnum" for the "U" command. -void u_saveline(buf_T *buf, linenr_T lnum) +static void u_saveline(buf_T *buf, linenr_T lnum) { if (lnum == buf->b_u_line_lnum) { // line is already saved return; diff --git a/src/nvim/window.c b/src/nvim/window.c index 92b8eab184..b38799514a 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4262,7 +4262,7 @@ int win_new_tabpage(int after, char *filename) // Open a new tab page if ":tab cmd" was used. It will edit the same buffer, // like with ":split". // Returns OK if a new tab page was created, FAIL otherwise. -int may_open_tabpage(void) +static int may_open_tabpage(void) { int n = (cmdmod.cmod_tab == 0) ? postponed_split_tab : cmdmod.cmod_tab; diff --git a/test/unit/profile_spec.lua b/test/unit/profile_spec.lua index 27b817cf42..ed760c37d9 100644 --- a/test/unit/profile_spec.lua +++ b/test/unit/profile_spec.lua @@ -96,9 +96,6 @@ describe('profiling related functions', function() local function profile_cmp(t1, t2) return prof.profile_cmp(t1, t2) end - local function profile_equal(t1, t2) - return prof.profile_equal(t1, t2) - end local function profile_msg(q) return ffi.string(prof.profile_msg(q)) end @@ -110,20 +107,6 @@ describe('profiling related functions', function() return tonumber(s) + tonumber(us) / 1000000 end - describe('profile_equal', function() - itp('times are equal to themselves', function() - local start = profile_start() - assert.is_true(profile_equal(start, start)) - - local e = profile_end(start) - assert.is_true(profile_equal(e, e)) - end) - - itp('times are unequal to others', function() - assert.is_false(profile_equal(profile_start(), profile_start())) - end) - end) - -- this is quite difficult to test, as it would rely on other functions in -- the profiling package. Those functions in turn will probably be tested -- using profile_cmp... circular reasoning. @@ -169,7 +152,6 @@ describe('profiling related functions', function() describe('profile_zero', function() itp('returns the same value on each call', function() eq(0, profile_zero()) - assert.is_true(profile_equal(profile_zero(), profile_zero())) end) end) @@ -203,7 +185,7 @@ describe('profiling related functions', function() describe('profile_setlimit', function() itp('sets no limit when 0 is passed', function() - eq(true, profile_equal(profile_setlimit(0), profile_zero())) + eq(profile_setlimit(0), profile_zero()) end) itp('sets a limit in the future otherwise', function()