diff options
Diffstat (limited to 'src/nvim/mark.c')
-rw-r--r-- | src/nvim/mark.c | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 2737380a8e..a142d12c13 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -131,7 +131,7 @@ int setmark_pos(int c, pos_T *pos, int fnum) i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; - free(namedfm[i].fname); + xfree(namedfm[i].fname); namedfm[i].fname = NULL; return OK; } @@ -146,9 +146,6 @@ void setpcmark(void) { int i; xfmark_T *fm; -#ifdef JUMPLIST_ROTATE - xfmark_T tempmark; -#endif /* for :global the mark is set only once */ if (global_busy || listcmd_busy || cmdmod.keepjumps) @@ -157,27 +154,10 @@ void setpcmark(void) curwin->w_prev_pcmark = curwin->w_pcmark; curwin->w_pcmark = curwin->w_cursor; -# ifdef JUMPLIST_ROTATE - /* - * If last used entry is not at the top, put it at the top by rotating - * the stack until it is (the newer entries will be at the bottom). - * Keep one entry (the last used one) at the top. - */ - if (curwin->w_jumplistidx < curwin->w_jumplistlen) - ++curwin->w_jumplistidx; - while (curwin->w_jumplistidx < curwin->w_jumplistlen) { - tempmark = curwin->w_jumplist[curwin->w_jumplistlen - 1]; - for (i = curwin->w_jumplistlen - 1; i > 0; --i) - curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; - curwin->w_jumplist[0] = tempmark; - ++curwin->w_jumplistidx; - } -# endif - /* If jumplist is full: remove oldest entry */ if (++curwin->w_jumplistlen > JUMPLISTSIZE) { curwin->w_jumplistlen = JUMPLISTSIZE; - free(curwin->w_jumplist[0].fname); + xfree(curwin->w_jumplist[0].fname); for (i = 1; i < JUMPLISTSIZE; ++i) curwin->w_jumplist[i - 1] = curwin->w_jumplist[i]; } @@ -516,7 +496,7 @@ void fmarks_check_names(buf_T *buf) } } - free(name); + xfree(name); } static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf) @@ -525,7 +505,7 @@ static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf) && fm->fname != NULL && fnamecmp(name, fm->fname) == 0) { fm->fmark.fnum = buf->b_fnum; - free(fm->fname); + xfree(fm->fname); fm->fname = NULL; } } @@ -643,7 +623,7 @@ void do_marks(exarg_T *eap) arg, &namedfm[i].fmark.mark, name, namedfm[i].fmark.fnum == curbuf->b_fnum); if (namedfm[i].fmark.fnum != 0) - free(name); + xfree(name); } } show_one_mark('"', arg, &curbuf->b_last_cursor, NULL, TRUE); @@ -698,7 +678,7 @@ show_one_mark ( if (name != NULL) { msg_outtrans_attr(name, current ? hl_attr(HLF_D) : 0); if (mustfree) - free(name); + xfree(name); } } ui_flush(); /* show one line at a time */ @@ -755,7 +735,7 @@ void ex_delmarks(exarg_T *eap) else n = i - 'A'; namedfm[n].fmark.mark.lnum = 0; - free(namedfm[n].fname); + xfree(namedfm[n].fname); namedfm[n].fname = NULL; } } @@ -797,7 +777,7 @@ void ex_jumps(exarg_T *eap) msg_putchar('\n'); if (got_int) { - free(name); + xfree(name); break; } sprintf((char *)IObuff, "%c %2d %5ld %4d ", @@ -810,7 +790,7 @@ void ex_jumps(exarg_T *eap) msg_outtrans_attr(name, curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum ? hl_attr(HLF_D) : 0); - free(name); + xfree(name); os_breakcheck(); } ui_flush(); @@ -844,7 +824,7 @@ void ex_changes(exarg_T *eap) msg_outtrans(IObuff); name = mark_line(&curbuf->b_changelist[i], 17); msg_outtrans_attr(name, hl_attr(HLF_D)); - free(name); + xfree(name); os_breakcheck(); } ui_flush(); @@ -1140,7 +1120,7 @@ static void cleanup_jumplist(void) if (i >= curwin->w_jumplistlen) /* no duplicate */ curwin->w_jumplist[to++] = curwin->w_jumplist[from]; else - free(curwin->w_jumplist[from].fname); + xfree(curwin->w_jumplist[from].fname); } if (curwin->w_jumplistidx == curwin->w_jumplistlen) curwin->w_jumplistidx = to; @@ -1171,7 +1151,7 @@ void free_jumplist(win_T *wp) int i; for (i = 0; i < wp->w_jumplistlen; ++i) - free(wp->w_jumplist[i].fname); + xfree(wp->w_jumplist[i].fname); } void set_last_cursor(win_T *win) @@ -1187,7 +1167,7 @@ void free_all_marks(void) for (i = 0; i < NMARKS + EXTRA_MARKS; i++) if (namedfm[i].fmark.mark.lnum != 0) - free(namedfm[i].fname); + xfree(namedfm[i].fname); } #endif @@ -1232,7 +1212,7 @@ int read_viminfo_filemark(vir_T *virp, int force) fm->fmark.mark.coladd = 0; fm->fmark.fnum = 0; str = skipwhite(str); - free(fm->fname); + xfree(fm->fname); fm->fname = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE); } @@ -1267,9 +1247,9 @@ void write_viminfo_filemarks(FILE *fp) : (name != NULL && STRCMP(name, namedfm[i].fname) == 0))) break; - free(name); + xfree(name); - free(namedfm[i].fname); + xfree(namedfm[i].fname); for (; i > NMARKS; --i) namedfm[i] = namedfm[i - 1]; namedfm[NMARKS].fmark.mark = curwin->w_cursor; @@ -1313,7 +1293,7 @@ static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2) } if (fm->fmark.fnum != 0) - free(name); + xfree(name); } /* @@ -1337,7 +1317,7 @@ int removable(char_u *name) } } } - free(name); + xfree(name); return retval; } @@ -1494,7 +1474,7 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags count++; } } - free(str); + xfree(str); pos.coladd = 0; while (!(eof = viminfo_readline(virp)) && line[0] == TAB) { @@ -1540,5 +1520,5 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags break; } } - free(name_buf); + xfree(name_buf); } |