patch 9.1.0138: too many STRLEN calls when getting a memline
Problem: too many STRLEN calls when getting a memline
Solution: Optimize calls to STRLEN(), add a few functions in memline.c
that return the byte length instead of relying on STRLEN()
(John Marriott)
closes: #14052
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/proto/memline.pro b/src/proto/memline.pro
index 3fa8707..eb21a7e 100644
--- a/src/proto/memline.pro
+++ b/src/proto/memline.pro
@@ -19,6 +19,10 @@
char_u *ml_get_pos(pos_T *pos);
char_u *ml_get_curline(void);
char_u *ml_get_cursor(void);
+colnr_T ml_get_len(linenr_T lnum);
+colnr_T ml_get_curline_len(void);
+colnr_T ml_get_cursor_len(void);
+colnr_T ml_get_buf_len(buf_T *buf, linenr_T lnum);
char_u *ml_get_buf(buf_T *buf, linenr_T lnum, int will_change);
int ml_line_alloced(void);
int ml_append(linenr_T lnum, char_u *line, colnr_T len, int newfile);