0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.1181: Unnecessary STRLEN() calls in insexpand.c

Problem:  Unnecessary STRLEN() calls in insexpand.c (after 9.1.1178).
Solution: Use the already available length (zeertzjq).

closes: #16814

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-03-07 19:06:02 +01:00
committed by Christian Brabandt
parent b3a9127494
commit 4422de6316
2 changed files with 10 additions and 7 deletions

View File

@@ -3934,7 +3934,7 @@ fuzzy_longest_match(void)
}
prefix = compl_best_matches[0]->cp_str.string;
prefix_len = (int)STRLEN(prefix);
prefix_len = (int)compl_best_matches[0]->cp_str.length;
for (i = 1; i < compl_num_bests; i++)
{
@@ -3958,14 +3958,13 @@ fuzzy_longest_match(void)
}
leader = ins_compl_leader();
if (leader != NULL)
leader_len = STRLEN(leader);
leader_len = ins_compl_leader_len();
// skip non-consecutive prefixes
if (STRNCMP(prefix, leader, leader_len) != 0)
if (leader_len > 0 && STRNCMP(prefix, leader, leader_len) != 0)
goto end;
prefix = vim_strnsave(compl_best_matches[0]->cp_str.string, prefix_len);
prefix = vim_strnsave(prefix, prefix_len);
if (prefix != NULL)
{
ins_compl_longest_insert(prefix);
@@ -5829,8 +5828,10 @@ ins_compl_start(void)
compl_orig_text.string = vim_strnsave(line + compl_col, (size_t)compl_length);
if (p_ic)
flags |= CP_ICASE;
if (compl_orig_text.string == NULL || ins_compl_add(compl_orig_text.string,
-1, NULL, NULL, NULL, 0, flags, FALSE, NULL, 0) != OK)
if (compl_orig_text.string == NULL
|| ins_compl_add(compl_orig_text.string,
(int)compl_orig_text.length,
NULL, NULL, NULL, 0, flags, FALSE, NULL, 0) != OK)
{
VIM_CLEAR_STRING(compl_pattern);
VIM_CLEAR_STRING(compl_orig_text);

View File

@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1181,
/**/
1180,
/**/