summaryrefslogtreecommitdiff
path: root/Src/Zle/compcore.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2022-03-25 23:57:30 +0100
committerMikael Magnusson <mikachu@gmail.com>2022-03-30 08:07:39 +0200
commit48be30e530a6786f1d47a3dd79f4b6eef2967639 (patch)
tree19d20f79133c82bfa9ccd188f621abd95632892b /Src/Zle/compcore.c
parent596b8e3faefe9e245b45198ae42296d3b0070f5f (diff)
downloadzsh-48be30e530a6786f1d47a3dd79f4b6eef2967639.tar.gz
zsh-48be30e530a6786f1d47a3dd79f4b6eef2967639.zip
49893: Fix comments for UNIQCON/ALL
Diffstat (limited to 'Src/Zle/compcore.c')
-rw-r--r--Src/Zle/compcore.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index c6deff756..a9ace5587 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -3254,10 +3254,13 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
qsort((void *) rp, n, sizeof(Cmatch),
(int (*) _((const void *, const void *)))matchcmp);
+ /* since the matches are sorted and the default is to remove
+ * all duplicates, -1 (remove only consecutive dupes) is a no-op,
+ * so this condition only checks for -2 */
if (!(flags & CGF_UNIQCON)) {
int dup;
- /* And delete the ones that occur more than once. */
+ /* we did not pass -2 so go ahead and remove those dupes */
for (ap = cp = rp; *ap; ap++) {
*cp++ = *ap;
for (bp = ap; bp[1] && matcheq(*ap, bp[1]); bp++, n--);
@@ -3279,7 +3282,9 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
if ((*ap)->flags & (CMF_NOLIST | CMF_MULT))
nl++;
}
+ /* used -O nosort or -V, don't sort */
} else {
+ /* didn't use -1 or -2, so remove all duplicates (inefficient) */
if (!(flags & CGF_UNIQALL) && !(flags & CGF_UNIQCON)) {
int dup;
@@ -3303,6 +3308,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
(*ap)->flags |= CMF_FMULT;
}
}
+ /* passed -1 but not -2, so remove consecutive duplicates (efficient) */
} else if (!(flags & CGF_UNIQCON)) {
int dup;