mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
vim-patch:9.0.1236: code in same_leader() can be simplified (#21968)
Problem: Code in same_leader() can be simplified.
Solution: Simplify code that is executed only once. (closes vim/vim#11867)
9cbf791995
This commit is contained in:
@@ -530,9 +530,6 @@ static bool same_leader(linenr_T lnum, int leader1_len, char *leader1_flags, int
|
||||
return leader2_len == 0;
|
||||
}
|
||||
|
||||
char *lnum_line = NULL;
|
||||
int line_len = 0;
|
||||
|
||||
// If first leader has 'f' flag, the lines can be joined only if the
|
||||
// second line does not have a leader.
|
||||
// If first leader has 'e' flag, the lines can never be joined.
|
||||
@@ -547,10 +544,7 @@ static bool same_leader(linenr_T lnum, int leader1_len, char *leader1_flags, int
|
||||
return false;
|
||||
}
|
||||
if (*p == COM_START) {
|
||||
if (lnum_line == NULL) {
|
||||
lnum_line = ml_get(lnum);
|
||||
line_len = (int)strlen(lnum_line);
|
||||
}
|
||||
int line_len = (int)strlen(ml_get(lnum));
|
||||
if (line_len <= leader1_len) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user