diff src/quickfix.c @ 14976:676db1b7fc35 v8.1.0499

patch 8.1.0499: :2vimgrep causes an ml_get error commit https://github.com/vim/vim/commit/1c29943416207e21abbc790eaf563b36789170c2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 28 14:36:09 2018 +0100 patch 8.1.0499: :2vimgrep causes an ml_get error Problem: :2vimgrep causes an ml_get error Solution: Pass tomatch pointer instead of value. (Yegappan Lakshmanan)
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Oct 2018 14:45:05 +0100
parents 940def6df43f
children 3a3c9b638187
line wrap: on
line diff
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -5217,7 +5217,7 @@ vgr_match_buflines(
 	char_u	    *fname,
 	buf_T	    *buf,
 	regmmatch_T *regmatch,
-	long	    tomatch,
+	long	    *tomatch,
 	int	    duplicate_name,
 	int	    flags)
 {
@@ -5225,7 +5225,7 @@ vgr_match_buflines(
     long	lnum;
     colnr_T	col;
 
-    for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; ++lnum)
+    for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum)
     {
 	col = 0;
 	while (vim_regexec_multi(regmatch, curwin, buf, lnum,
@@ -5255,7 +5255,7 @@ vgr_match_buflines(
 		break;
 	    }
 	    found_match = TRUE;
-	    if (--tomatch == 0)
+	    if (--*tomatch == 0)
 		break;
 	    if ((flags & VGR_GLOBAL) == 0
 		    || regmatch->endpos[0].lnum > 0)
@@ -5464,7 +5464,7 @@ ex_vimgrep(exarg_T *eap)
 	    // Try for a match in all lines of the buffer.
 	    // For ":1vimgrep" look for first match only.
 	    found_match = vgr_match_buflines(qi, fname, buf, &regmatch,
-		    tomatch, duplicate_name, flags);
+		    &tomatch, duplicate_name, flags);
 
 	    if (using_dummy)
 	    {