aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/stdlib.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-12 10:44:53 +0800
committerGitHub <noreply@github.com>2024-03-12 10:44:53 +0800
commitac8cd5368db83cced9bc049ceb50c21cb8a4f743 (patch)
tree8e0a97c534a79c97aa881002fd847be677e66f9c /src/nvim/lua/stdlib.c
parentb02a4d8ac39bafdbfd490bfbab35e3202e6f709c (diff)
downloadrneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.tar.gz
rneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.tar.bz2
rneovim-ac8cd5368db83cced9bc049ceb50c21cb8a4f743.zip
refactor: use ml_get_buf_len() in API code (#27825)
Diffstat (limited to 'src/nvim/lua/stdlib.c')
-rw-r--r--src/nvim/lua/stdlib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index 8f58fd1a1a..a5262efcfa 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -107,15 +107,15 @@ static int regex_match_line(lua_State *lstate)
}
char *line = ml_get_buf(buf, rownr + 1);
- size_t len = strlen(line);
+ colnr_T len = ml_get_buf_len(buf, rownr + 1);
- if (start < 0 || (size_t)start > len) {
+ if (start < 0 || start > len) {
return luaL_error(lstate, "invalid start");
}
char save = NUL;
if (end >= 0) {
- if ((size_t)end > len || end < start) {
+ if (end > len || end < start) {
return luaL_error(lstate, "invalid end");
}
save = line[end];