1
0
forked from aniani/vim

patch 8.0.1496: clearing a pointer takes two lines

Problem:    Clearing a pointer takes two lines.
Solution:   Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
            closes #2629)
This commit is contained in:
Bram Moolenaar
2018-02-10 18:45:26 +01:00
parent 42443c7d7f
commit d23a823669
54 changed files with 233 additions and 465 deletions

View File

@@ -3996,10 +3996,7 @@ theend:
/* Free "reg_tofree" when it's a bit big.
* Free regstack and backpos if they are bigger than their initial size. */
if (reg_tofreelen > 400)
{
vim_free(reg_tofree);
reg_tofree = NULL;
}
VIM_CLEAR(reg_tofree);
if (regstack.ga_maxlen > REGSTACK_INITIAL)
ga_clear(&regstack);
if (backpos.ga_maxlen > BACKPOS_INITIAL)
@@ -7521,8 +7518,7 @@ vim_regsub_both(
{
STRCPY(dest, eval_result);
dst += STRLEN(eval_result);
vim_free(eval_result);
eval_result = NULL;
VIM_CLEAR(eval_result);
}
}
else
@@ -8150,7 +8146,7 @@ vim_regcomp(char_u *expr_arg, int re_flags)
* First try the NFA engine, unless backtracking was requested.
*/
if (regexp_engine != BACKTRACKING_ENGINE)
prog = nfa_regengine.regcomp(expr,
prog = nfa_regengine.regcomp(expr,
re_flags + (regexp_engine == AUTOMATIC_ENGINE ? RE_AUTO : 0));
else
prog = bt_regengine.regcomp(expr, re_flags);
@@ -8170,7 +8166,7 @@ vim_regcomp(char_u *expr_arg, int re_flags)
}
else
EMSG2("(NFA) Could not open \"%s\" to write !!!",
BT_REGEXP_DEBUG_LOG_NAME);
BT_REGEXP_DEBUG_LOG_NAME);
}
#endif
/*
@@ -8341,10 +8337,10 @@ vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col)
long
vim_regexec_multi(
regmmatch_T *rmp,
win_T *win, /* window in which to search or NULL */
buf_T *buf, /* buffer in which to search */
linenr_T lnum, /* nr of line to start looking for match */
colnr_T col, /* column to start looking for match */
win_T *win, /* window in which to search or NULL */
buf_T *buf, /* buffer in which to search */
linenr_T lnum, /* nr of line to start looking for match */
colnr_T col, /* column to start looking for match */
proftime_T *tm, /* timeout limit or NULL */
int *timed_out) /* flag is set when timeout limit reached */
{