patch 9.1.0163: Calling STRLEN() to compute ml_line_textlen when not needed
Problem: Calling STRLEN() to compute ml_line_textlen when not needed.
Solution: Use 0 when STRLEN() will be required and call STRLEN() later.
(zeertzjq)
closes: #14155
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/structs.h b/src/structs.h
index b3b3f6a..47a0050 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -802,8 +802,8 @@
#define ML_ALLOCATED 0x10 // ml_line_ptr is an allocated copy
int ml_flags;
- colnr_T ml_line_len; // length of the cached line + textproperties, including NUL
- colnr_T ml_line_textlen;// length of the cached line, including NUL
+ colnr_T ml_line_len; // length of the cached line + NUL + text properties
+ colnr_T ml_line_textlen;// length of the cached line + NUL, 0 if not known yet
linenr_T ml_line_lnum; // line number of cached line, 0 if not valid
char_u *ml_line_ptr; // pointer to cached line