Skip to content

Commit 88b7359

Browse files
John Marriottchrisbra
authored andcommitted
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 <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 5eb9448 commit 88b7359

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/cmdexpand.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,16 +3718,17 @@ ExpandGenericExt(
37183718
*/
37193719
static void
37203720
expand_shellcmd_onedir(
3721-
char_u *pat,
3722-
size_t pathlen, // length of the path portion of pat.
3721+
char_u *pathed_pattern, // fully pathed pattern
3722+
size_t pathlen, // length of the path portion of pathed_pattern
3723+
// (0 if no path).
37233724
char_u ***matches,
37243725
int *numMatches,
37253726
int flags,
37263727
hashtab_T *ht,
37273728
garray_T *gap)
37283729
{
37293730
// Expand matches in one directory of $PATH.
3730-
if (expand_wildcards(1, &pat, numMatches, matches, flags) != OK)
3731+
if (expand_wildcards(1, &pathed_pattern, numMatches, matches, flags) != OK)
37313732
return;
37323733

37333734
if (ga_grow(gap, *numMatches) == FAIL)
@@ -3878,6 +3879,9 @@ expand_shellcmd(
38783879
seplen = !after_pathsep(s, e) ? STRLEN_LITERAL(PATHSEPSTR) : 0;
38793880
}
38803881

3882+
// Make sure that the pathed pattern (ie the path and pattern concatenated
3883+
// together) will fit inside the buffer. If not skip it and move on to the
3884+
// next path.
38813885
if (pathlen + seplen + patlen + 1 <= MAXPATHL)
38823886
{
38833887
if (pathlen > 0)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1570,
722724
/**/
723725
1569,
724726
/**/

0 commit comments

Comments
 (0)