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 <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2025-07-20 10:28:26 +02:00
committed by Christian Brabandt
parent 5eb9448743
commit 88b735973c
2 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1570,
/**/
1569,
/**/