mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.1.0824: too many strlen() calls in register.c
Problem: too many strlen() calls in register.c Solution: refactor code, add string_T struct to keep track of string lengths (John Marriott) closes: #15952 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
a68bd6f089
commit
79f6ffd388
@@ -20,6 +20,13 @@ typedef int colnr_T;
|
||||
typedef unsigned short short_u;
|
||||
#endif
|
||||
|
||||
// structure to store a string (including it's length)
|
||||
typedef struct
|
||||
{
|
||||
char_u *string; // the string
|
||||
size_t length; // length of the string (excluding the NUL)
|
||||
} string_T;
|
||||
|
||||
/*
|
||||
* Position in file or buffer.
|
||||
*/
|
||||
@@ -4784,7 +4791,7 @@ struct block_def
|
||||
// Each yank register has an array of pointers to lines.
|
||||
typedef struct
|
||||
{
|
||||
char_u **y_array; // pointer to array of line pointers
|
||||
string_T *y_array; // pointer to array of string_T structs
|
||||
linenr_T y_size; // number of lines in y_array
|
||||
char_u y_type; // MLINE, MCHAR or MBLOCK
|
||||
colnr_T y_width; // only set if y_type == MBLOCK
|
||||
|
Reference in New Issue
Block a user