aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/quickfix.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-14 13:35:04 +0800
committerGitHub <noreply@github.com>2024-03-14 13:35:04 +0800
commit274e414c94a74c7f90952327f69a8a1d65e9f00a (patch)
tree132b06712a25cc34f93883a9ea63c26b4ce4bf45 /src/nvim/quickfix.c
parent3502aa63f0f4ea8d8982aea81a819424e71029bc (diff)
parent61b48e91b941258e6945e3eafadc777dccef5b75 (diff)
downloadrneovim-274e414c94a74c7f90952327f69a8a1d65e9f00a.tar.gz
rneovim-274e414c94a74c7f90952327f69a8a1d65e9f00a.tar.bz2
rneovim-274e414c94a74c7f90952327f69a8a1d65e9f00a.zip
Merge pull request #27850 from zeertzjq/vim-9.1.0172
vim-patch:9.1.{0172,0177}: more code can use ml_get_buf_len()
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r--src/nvim/quickfix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index bf53dca167..0f639bf86a 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -773,9 +773,9 @@ static int qf_get_next_buf_line(qfstate_T *state)
return QF_END_OF_INPUT;
}
char *p_buf = ml_get_buf(state->buf, state->buflnum);
+ size_t len = (size_t)ml_get_buf_len(state->buf, state->buflnum);
state->buflnum += 1;
- size_t len = strlen(p_buf);
if (len > IOSIZE - 2) {
state->linebuf = qf_grow_linebuf(state, len);
} else {
@@ -5356,12 +5356,13 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
break;
}
col = regmatch->endpos[0].col + (col == regmatch->endpos[0].col);
- if (col > (colnr_T)strlen(ml_get_buf(buf, lnum))) {
+ if (col > ml_get_buf_len(buf, lnum)) {
break;
}
}
} else {
char *const str = ml_get_buf(buf, lnum);
+ const colnr_T linelen = ml_get_buf_len(buf, lnum);
int score;
uint32_t matches[MAX_FUZZY_MATCHES];
const size_t sz = sizeof(matches) / sizeof(matches[0]);
@@ -5400,7 +5401,7 @@ static bool vgr_match_buflines(qf_list_T *qfl, char *fname, buf_T *buf, char *sp
break;
}
col = (colnr_T)matches[pat_len - 1] + col + 1;
- if (col > (colnr_T)strlen(str)) {
+ if (col > linelen) {
break;
}
}