diff options
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 0ec0d5df9d..bd5dfa92cc 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -188,6 +188,11 @@ typedef struct { */ #define GET_LOC_LIST(wp) (IS_LL_WINDOW(wp) ? wp->w_llist_ref : wp->w_llist) +// Looking up a buffer can be slow if there are many. Remember the last one +// to make this a lot faster if there are multiple matches in the same file. +static char_u *qf_last_bufname = NULL; +static bufref_T qf_last_bufref = { NULL, 0, 0 }; + /* * Read the errorfile "efile" into memory, line by line, building the error * list. Set the error list's title to qf_title. @@ -968,6 +973,10 @@ qf_init_ext( int retval = -1; // default: return error flag int status; + // Do not used the cached buffer, it may have been wiped out. + xfree(qf_last_bufname); + qf_last_bufname = NULL; + fields.namebuf = xmalloc(CMDBUFFSIZE + 1); fields.errmsglen = CMDBUFFSIZE + 1; fields.errmsg = xmalloc(fields.errmsglen); @@ -1399,11 +1408,6 @@ void copy_loclist(win_T *from, win_T *to) to->w_llist->qf_curlist = qi->qf_curlist; /* current list */ } -// Looking up a buffer can be slow if there are many. Remember the last one to -// make this a lot faster if there are multiple matches in the same file. -static char_u *qf_last_bufname = NULL; -static bufref_T qf_last_bufref = { NULL, 0 }; - // Get buffer number for file "directory.fname". // Also sets the b_has_qf_entry flag. static int qf_get_fnum(qf_info_T *qi, char_u *directory, char_u *fname) @@ -2326,9 +2330,7 @@ void qf_history(exarg_T *eap) } } -/* - * Free error list "idx". - */ +/// Free all the entries in the error list "idx". static void qf_free(qf_info_T *qi, int idx) { qfline_T *qfp; @@ -4023,7 +4025,7 @@ int get_errorlist_properties(win_T *wp, dict_T *what, dict_T *retdict) if ((di = tv_dict_find(what, S_LEN("nr"))) != NULL) { // Use the specified quickfix/location list if (di->di_tv.v_type == VAR_NUMBER) { - qf_idx = di->di_tv.vval.v_number - 1; + qf_idx = (int)di->di_tv.vval.v_number - 1; if (qf_idx < 0 || qf_idx >= qi->qf_listcount) { return FAIL; } @@ -4097,7 +4099,7 @@ static int qf_add_entries(qf_info_T *qi, list_T *list, char_u *title, char *const filename = tv_dict_get_string(d, "filename", true); int bufnum = (int)tv_dict_get_number(d, "bufnr"); - long lnum = tv_dict_get_number(d, "lnum"); + long lnum = (long)tv_dict_get_number(d, "lnum"); int col = (int)tv_dict_get_number(d, "col"); char_u vcol = (char_u)tv_dict_get_number(d, "vcol"); int nr = (int)tv_dict_get_number(d, "nr"); @@ -4179,7 +4181,7 @@ static int qf_set_properties(qf_info_T *qi, dict_T *what, int action) if ((di = tv_dict_find(what, S_LEN("nr"))) != NULL) { // Use the specified quickfix/location list if (di->di_tv.v_type == VAR_NUMBER) { - qf_idx = di->di_tv.vval.v_number - 1; + qf_idx = (int)di->di_tv.vval.v_number - 1; if (qf_idx < 0 || qf_idx >= qi->qf_listcount) { return FAIL; } |