comparison 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
comparison
equal deleted inserted replaced
14975:0b92912925c7 14976:676db1b7fc35
5215 vgr_match_buflines( 5215 vgr_match_buflines(
5216 qf_info_T *qi, 5216 qf_info_T *qi,
5217 char_u *fname, 5217 char_u *fname,
5218 buf_T *buf, 5218 buf_T *buf,
5219 regmmatch_T *regmatch, 5219 regmmatch_T *regmatch,
5220 long tomatch, 5220 long *tomatch,
5221 int duplicate_name, 5221 int duplicate_name,
5222 int flags) 5222 int flags)
5223 { 5223 {
5224 int found_match = FALSE; 5224 int found_match = FALSE;
5225 long lnum; 5225 long lnum;
5226 colnr_T col; 5226 colnr_T col;
5227 5227
5228 for (lnum = 1; lnum <= buf->b_ml.ml_line_count && tomatch > 0; ++lnum) 5228 for (lnum = 1; lnum <= buf->b_ml.ml_line_count && *tomatch > 0; ++lnum)
5229 { 5229 {
5230 col = 0; 5230 col = 0;
5231 while (vim_regexec_multi(regmatch, curwin, buf, lnum, 5231 while (vim_regexec_multi(regmatch, curwin, buf, lnum,
5232 col, NULL, NULL) > 0) 5232 col, NULL, NULL) > 0)
5233 { 5233 {
5253 { 5253 {
5254 got_int = TRUE; 5254 got_int = TRUE;
5255 break; 5255 break;
5256 } 5256 }
5257 found_match = TRUE; 5257 found_match = TRUE;
5258 if (--tomatch == 0) 5258 if (--*tomatch == 0)
5259 break; 5259 break;
5260 if ((flags & VGR_GLOBAL) == 0 5260 if ((flags & VGR_GLOBAL) == 0
5261 || regmatch->endpos[0].lnum > 0) 5261 || regmatch->endpos[0].lnum > 0)
5262 break; 5262 break;
5263 col = regmatch->endpos[0].col 5263 col = regmatch->endpos[0].col
5462 else 5462 else
5463 { 5463 {
5464 // Try for a match in all lines of the buffer. 5464 // Try for a match in all lines of the buffer.
5465 // For ":1vimgrep" look for first match only. 5465 // For ":1vimgrep" look for first match only.
5466 found_match = vgr_match_buflines(qi, fname, buf, &regmatch, 5466 found_match = vgr_match_buflines(qi, fname, buf, &regmatch,
5467 tomatch, duplicate_name, flags); 5467 &tomatch, duplicate_name, flags);
5468 5468
5469 if (using_dummy) 5469 if (using_dummy)
5470 { 5470 {
5471 if (found_match && first_match_buf == NULL) 5471 if (found_match && first_match_buf == NULL)
5472 first_match_buf = buf; 5472 first_match_buf = buf;