Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: pws-5 seg-fault (old-style) completion



jarausch@xxxxxxxxxxxxxxxxxxx wrote:

> Hi,
> I've a problem with pws-5 and old style completion (see my zshenv below)
> do e.g.
> ls CI<Tab>
> where there is NO file like CI*, I get a segment fault here on my IRIX
> box.
> My backup version pws-3 doesn't have that problem.

Oh dear... (better not treat strings like pointers to cmatch structs).

Bye
 Sven

--- Src/Zle/zle_tricky.c.old	Tue Sep 21 16:08:54 1999
+++ Src/Zle/zle_tricky.c	Tue Sep 21 16:08:56 1999
@@ -5255,7 +5255,7 @@
 	endcmgroup(NULL);
 
 	if (amatches && !oldlist)
-	    amatches->ccs = (Compctl *) makearray(ccused, 0,
+	    amatches->ccs = (Compctl *) makearray(ccused, 0, 0,
 						  &(amatches->ccount), NULL, NULL);
 	else {
 	    LinkNode n;
@@ -7221,7 +7221,7 @@
 
 /**/
 static Cmatch *
-makearray(LinkList l, int s, int *np, int *nlp, int *llp)
+makearray(LinkList l, int s, int u, int *np, int *nlp, int *llp)
 {
     Cmatch *ap, *bp, *cp, *rp;
     LinkNode nod;
@@ -7272,7 +7272,7 @@
 		nl++;
 	}
 	*cp = NULL;
-    } else {
+    } else if (u) {
 	for (ap = rp; *ap; ap++) {
 	    for (bp = cp = ap + 1; *bp; bp++) {
 		if (!matcheq(*ap, *bp))
@@ -7430,7 +7430,7 @@
 		g->lmatches = g->lfmatches;
 
 	    g->matches = makearray(g->lmatches,
-				   ((g->flags & CGF_NOSORT) ? 0 : 2),
+				   ((g->flags & CGF_NOSORT) ? 0 : 2), 1,
 				   &nn, &nl, &ll);
 	    g->mcount = nn;
 	    if ((g->lcount = nn - nl) < 0)
@@ -7440,7 +7440,7 @@
 		g->lcount = arrlen(g->ylist);
 		smatches = 2;
 	    }
-	    g->expls = (Cexpl *) makearray(g->lexpls, 0, &(g->ecount),
+	    g->expls = (Cexpl *) makearray(g->lexpls, 0, 0, &(g->ecount),
 					   NULL, NULL);
 
 	    g->ccount = 0;
@@ -8822,7 +8822,7 @@
     smatches = 1;
     validlist = 1;
     memset(&dg, 0, sizeof(struct cmgroup));
-    dg.ylist = (char **) makearray(l, 1, &(dg.lcount), NULL, NULL);
+    dg.ylist = (char **) makearray(l, 1, 0, &(dg.lcount), NULL, NULL);
     amatches = &dg;
     ilistmatches(NULL, NULL);
     amatches = am;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author