From: zeertzjq Date: Fri, 16 Jan 2026 18:31:33 +0000 (+0000) Subject: patch 9.1.2088: Redundant NULL checks in find_pattern_in_path() X-Git-Tag: v9.1.2088^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ce394b13e9df1f995525198887f0a2289410a7c5;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/search.c b/src/search.c index 6400ceb3dc..5d50b1fc5b 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 7e93ea3636..e4ae578201 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 517bffab12..00c2988f99 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, /**/