changeset 31807:defef01ac8ea v9.0.1236

patch 9.0.1236: code in same_leader() can be simplified Commit: https://github.com/vim/vim/commit/9cbf791995514e72476399fe06e055a707ec0158 Author: zeertzjq <zeertzjq@outlook.com> Date: Mon Jan 23 16:57:08 2023 +0000 patch 9.0.1236: code in same_leader() can be simplified Problem: Code in same_leader() can be simplified. Solution: Simplify code that is executed only once. (closes https://github.com/vim/vim/issues/11867)
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Jan 2023 18:00:05 +0100
parents 885c61178118
children e1d9d84d0eba
files src/textformat.c src/version.c
diffstat 2 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/textformat.c
+++ b/src/textformat.c
@@ -540,9 +540,6 @@ same_leader(
     if (leader1_len == 0)
 	return (leader2_len == 0);
 
-    char_u  *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.
@@ -558,11 +555,7 @@ same_leader(
 		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;
 		if (leader2_flags == NULL || leader2_len == 0)
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1236,
+/**/
     1235,
 /**/
     1234,