To: vim_dev@googlegroups.com Subject: Patch 9.0.1236 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1236 Problem: Code in same_leader() can be simplified. Solution: Simplify code that is executed only once. (closes #11867) Files: src/textformat.c *** ../vim-9.0.1235/src/textformat.c 2023-01-21 13:09:15.582541093 +0000 --- src/textformat.c 2023-01-23 16:51:58.732164399 +0000 *************** *** 540,548 **** 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. --- 540,545 ---- *************** *** 558,568 **** return FALSE; if (*p == COM_START) { ! if (lnum_line == NULL) ! { ! lnum_line = ml_get(lnum); ! line_len = (int)STRLEN(lnum_line); ! } if (line_len <= leader1_len) return FALSE; if (leader2_flags == NULL || leader2_len == 0) --- 555,561 ---- return FALSE; if (*p == COM_START) { ! int line_len = (int)STRLEN(ml_get(lnum)); if (line_len <= leader1_len) return FALSE; if (leader2_flags == NULL || leader2_len == 0) *** ../vim-9.0.1235/src/version.c 2023-01-23 12:33:15.826715782 +0000 --- src/version.c 2023-01-23 16:56:24.792377526 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1236, /**/ -- The 50-50-90 rule: Anytime you have a 50-50 chance of getting something right, there's a 90% probability you'll get it wrong. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///