summaryrefslogtreecommitdiff
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
commitd23a823669d93fb2a570a039173eefe4856ac806 (patch)
tree617130258eae70e3bd7ef7b6da9c494ffee7b572 /src/regexp.c
parent42443c7d7fecc3a2a72154bb6139b028438617c2 (diff)
downloadvim-git-d23a823669d93fb2a570a039173eefe4856ac806.tar.gz
patch 8.0.1496: clearing a pointer takes two linesv8.0.1496
Problem: Clearing a pointer takes two lines. Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, closes #2629)
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/regexp.c b/src/regexp.c
index 7f5e265eb..d07391eef 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -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 */
{