From: John Marriott Date: Sun, 20 Jul 2025 08:28:26 +0000 (+0200) Subject: patch 9.1.1570: Copilot suggested some improvements in cmdexpand.c X-Git-Tag: v9.1.1570^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88b735973c4c40b1b97620fbf90695944dbde85f;p=thirdparty%2Fvim.git patch 9.1.1570: Copilot suggested some improvements in cmdexpand.c Problem: Copilot suggested some improvements in cmdexpand.c (after v9.1.1556) Solution: Use better variable names and comments (John Marriott). closes: #17795 Signed-off-by: John Marriott Signed-off-by: Christian Brabandt --- diff --git a/src/cmdexpand.c b/src/cmdexpand.c index 449636f736..a7a5acf95f 100644 --- a/src/cmdexpand.c +++ b/src/cmdexpand.c @@ -3718,8 +3718,9 @@ ExpandGenericExt( */ static void expand_shellcmd_onedir( - char_u *pat, - size_t pathlen, // length of the path portion of pat. + char_u *pathed_pattern, // fully pathed pattern + size_t pathlen, // length of the path portion of pathed_pattern + // (0 if no path). char_u ***matches, int *numMatches, int flags, @@ -3727,7 +3728,7 @@ expand_shellcmd_onedir( garray_T *gap) { // Expand matches in one directory of $PATH. - if (expand_wildcards(1, &pat, numMatches, matches, flags) != OK) + if (expand_wildcards(1, &pathed_pattern, numMatches, matches, flags) != OK) return; if (ga_grow(gap, *numMatches) == FAIL) @@ -3878,6 +3879,9 @@ expand_shellcmd( seplen = !after_pathsep(s, e) ? STRLEN_LITERAL(PATHSEPSTR) : 0; } + // Make sure that the pathed pattern (ie the path and pattern concatenated + // together) will fit inside the buffer. If not skip it and move on to the + // next path. if (pathlen + seplen + patlen + 1 <= MAXPATHL) { if (pathlen > 0) diff --git a/src/version.c b/src/version.c index 7297bc8cc2..c7027a68ea 100644 --- a/src/version.c +++ b/src/version.c @@ -719,6 +719,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1570, /**/ 1569, /**/