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)
diff --git a/src/regexp.c b/src/regexp.c
index 7f5e265..d07391e 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -3996,10 +3996,7 @@
/* 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(®stack);
if (backpos.ga_maxlen > BACKPOS_INITIAL)
@@ -7521,8 +7518,7 @@
{
STRCPY(dest, eval_result);
dst += STRLEN(eval_result);
- vim_free(eval_result);
- eval_result = NULL;
+ VIM_CLEAR(eval_result);
}
}
else
@@ -8150,7 +8146,7 @@
* 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 @@
}
else
EMSG2("(NFA) Could not open \"%s\" to write !!!",
- BT_REGEXP_DEBUG_LOG_NAME);
+ BT_REGEXP_DEBUG_LOG_NAME);
}
#endif
/*
@@ -8341,10 +8337,10 @@
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 */
{