]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.1236: code in same_leader() can be simplified v9.0.1236
authorzeertzjq <zeertzjq@outlook.com>
Mon, 23 Jan 2023 16:57:08 +0000 (16:57 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 23 Jan 2023 16:57:08 +0000 (16:57 +0000)
Problem:    Code in same_leader() can be simplified.
Solution:   Simplify code that is executed only once. (closes #11867)

src/textformat.c
src/version.c

index 7ebbc8849a4594b8969932baf0b3ad035cb89fdb..3447a0a0e15455136ddfbf432c7013da5098e8cc 100644 (file)
@@ -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)
index 3e853b309353b9ce6b2067ec59774c08d1d5ca38..886d0a4dfc8a432e709bbe0c2f58c893364a9c42 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1236,
 /**/
     1235,
 /**/