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:
committed by
Christian Brabandt
parent
b3a9127494
commit
4422de6316
@@ -3934,7 +3934,7 @@ fuzzy_longest_match(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
prefix = compl_best_matches[0]->cp_str.string;
|
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++)
|
for (i = 1; i < compl_num_bests; i++)
|
||||||
{
|
{
|
||||||
@@ -3958,14 +3958,13 @@ fuzzy_longest_match(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
leader = ins_compl_leader();
|
leader = ins_compl_leader();
|
||||||
if (leader != NULL)
|
leader_len = ins_compl_leader_len();
|
||||||
leader_len = STRLEN(leader);
|
|
||||||
|
|
||||||
// skip non-consecutive prefixes
|
// skip non-consecutive prefixes
|
||||||
if (STRNCMP(prefix, leader, leader_len) != 0)
|
if (leader_len > 0 && STRNCMP(prefix, leader, leader_len) != 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
prefix = vim_strnsave(compl_best_matches[0]->cp_str.string, prefix_len);
|
prefix = vim_strnsave(prefix, prefix_len);
|
||||||
if (prefix != NULL)
|
if (prefix != NULL)
|
||||||
{
|
{
|
||||||
ins_compl_longest_insert(prefix);
|
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);
|
compl_orig_text.string = vim_strnsave(line + compl_col, (size_t)compl_length);
|
||||||
if (p_ic)
|
if (p_ic)
|
||||||
flags |= CP_ICASE;
|
flags |= CP_ICASE;
|
||||||
if (compl_orig_text.string == NULL || ins_compl_add(compl_orig_text.string,
|
if (compl_orig_text.string == NULL
|
||||||
-1, NULL, NULL, NULL, 0, flags, FALSE, NULL, 0) != OK)
|
|| 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_pattern);
|
||||||
VIM_CLEAR_STRING(compl_orig_text);
|
VIM_CLEAR_STRING(compl_orig_text);
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1181,
|
||||||
/**/
|
/**/
|
||||||
1180,
|
1180,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user