aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 29f090c6b7..0ead83e0d4 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -4177,7 +4177,6 @@ regmatch (
case BACK:
{
int i;
- backpos_T *bp;
/*
* When we run into BACK we need to check if we don't keep
@@ -4187,17 +4186,13 @@ regmatch (
* The positions are stored in "backpos" and found by the
* current value of "scan", the position in the RE program.
*/
- bp = (backpos_T *)backpos.ga_data;
+ backpos_T *bp = (backpos_T *)backpos.ga_data;
for (i = 0; i < backpos.ga_len; ++i)
if (bp[i].bp_scan == scan)
break;
if (i == backpos.ga_len) {
- /* First time at this BACK, make room to store the pos. */
- ga_grow(&backpos, 1);
- /* get "ga_data" again, it may have changed */
- bp = (backpos_T *)backpos.ga_data;
- bp[i].bp_scan = scan;
- ++backpos.ga_len;
+ backpos_T *p = GA_APPEND_VIA_PTR(backpos_T, &backpos);
+ p->bp_scan = scan;
} else if (reg_save_equal(&bp[i].bp_pos))
/* Still at same position as last time, fail. */
status = RA_NOMATCH;