mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
mark: Clear marks in some cases, but do not do useless job in free_\*
This commit is contained in:
parent
be45e75026
commit
22906265a2
2
.gitignore
vendored
2
.gitignore
vendored
@ -13,6 +13,8 @@
|
||||
*.o
|
||||
*.so
|
||||
|
||||
tags
|
||||
|
||||
/src/nvim/po/vim.pot
|
||||
/src/nvim/po/*.ck
|
||||
|
||||
|
@ -557,9 +557,9 @@ static void free_buffer(buf_T *buf)
|
||||
unref_var_dict(buf->b_vars);
|
||||
aubuflocal_remove(buf);
|
||||
dict_unref(buf->additional_data);
|
||||
free_fmark(buf->b_last_cursor);
|
||||
free_fmark(buf->b_last_insert);
|
||||
free_fmark(buf->b_last_change);
|
||||
clear_fmark(&buf->b_last_cursor);
|
||||
clear_fmark(&buf->b_last_insert);
|
||||
clear_fmark(&buf->b_last_change);
|
||||
for (size_t i = 0; i < NMARKS; i++) {
|
||||
free_fmark(buf->b_namedm[i]);
|
||||
}
|
||||
@ -569,6 +569,8 @@ static void free_buffer(buf_T *buf)
|
||||
if (autocmd_busy) {
|
||||
// Do not free the buffer structure while autocommands are executing,
|
||||
// it's still needed. Free it when autocmd_busy is reset.
|
||||
memset(&buf->b_namedm[0], 0, sizeof(buf->b_namedm));
|
||||
memset(&buf->b_changelist[0], 0, sizeof(buf->b_changelist));
|
||||
buf->b_next = au_pending_free_buf;
|
||||
au_pending_free_buf = buf;
|
||||
} else {
|
||||
|
@ -73,17 +73,23 @@ int setmark(int c)
|
||||
void free_fmark(fmark_T fm)
|
||||
{
|
||||
dict_unref(fm.additional_data);
|
||||
fm.additional_data = NULL;
|
||||
}
|
||||
|
||||
/// Free xfmark_T item
|
||||
void free_xfmark(xfmark_T fm)
|
||||
{
|
||||
xfree(fm.fname);
|
||||
fm.fname = NULL;
|
||||
free_fmark(fm.fmark);
|
||||
}
|
||||
|
||||
/// Free and clear fmark_T item
|
||||
void clear_fmark(fmark_T *fm)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
free_fmark(*fm);
|
||||
memset(fm, 0, sizeof(*fm));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set named mark "c" to position "pos".
|
||||
* When "c" is upper case use file "fnum".
|
||||
@ -1409,6 +1415,7 @@ void free_jumplist(win_T *wp)
|
||||
for (i = 0; i < wp->w_jumplistlen; ++i) {
|
||||
free_xfmark(wp->w_jumplist[i]);
|
||||
}
|
||||
wp->w_jumplistlen = 0;
|
||||
}
|
||||
|
||||
void set_last_cursor(win_T *win)
|
||||
@ -1428,5 +1435,6 @@ void free_all_marks(void)
|
||||
free_xfmark(namedfm[i]);
|
||||
}
|
||||
}
|
||||
memset(&namedfm[0], 0, sizeof(namedfm));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user