patch 9.1.2088: Redundant NULL checks in find_pattern_in_path()

Commit: 
https://github.com/vim/vim/commit/ce394b13e9df1f995525198887f0a2289410a7c5
Author: zeertzjq <[email protected]>
Date:   Fri Jan 16 18:31:33 2026 +0000

    patch 9.1.2088: Redundant NULL checks in find_pattern_in_path()
    
    Problem:  Redundant NULL checks in find_pattern_in_path().
    Solution: Remove the NULL checks. Also fix typos in test_diffmode.vim
              (zeertzjq).
    
    After assigning to inc_opt on line 3461, it's dereferenced immediately,
    and not assigned another value afterwards, so checking for NULL after
    line 3462 is redundant.
    
    closes: #19185
    
    Signed-off-by: zeertzjq <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/search.c b/src/search.c
index 6400ceb3d..5d50b1fc5 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3496,7 +3496,7 @@ find_pattern_in_path(
            char_u *p_fname = (curr_fname == curbuf->b_fname)
                                              ? curbuf->b_ffname : curr_fname;
 
-           if (inc_opt != NULL && strstr((char *)inc_opt, "\zs") != NULL)
+           if (strstr((char *)inc_opt, "\zs") != NULL)
                // Use text from '\zs' to '\ze' (or end) of 'include'.
                new_fname = find_file_name_in_path(incl_regmatch.startp[0],
                       (int)(incl_regmatch.endp[0] - incl_regmatch.startp[0]),
@@ -3578,8 +3578,7 @@ find_pattern_in_path(
                         * Isolate the file name.
                         * Include the surrounding "" or <> if present.
                         */
-                       if (inc_opt != NULL
-                                  && strstr((char *)inc_opt, "\zs") != NULL)
+                       if (strstr((char *)inc_opt, "\zs") != NULL)
                        {
                            // pattern contains \zs, use the match
                            p = incl_regmatch.startp[0];
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 7e93ea363..e4ae57820 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -3566,7 +3566,7 @@ func Test_diff_add_prop_in_autocmd()
   call StopVimInTerminal(buf)
 endfunc
 
-" this was causing a use-after-free by callig winframe_remove() rerursively
+" this was causing a use-after-free by calling winframe_remove() recursively
 func Test_diffexpr_wipe_buffers()
   CheckRunVimInTerminal
 
diff --git a/src/version.c b/src/version.c
index 517bffab1..00c2988f9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2088,
 /**/
     2087,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vgooh-00GBwm-4e%40256bit.org.

Raspunde prin e-mail lui