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

PATCH: completion fixes



There was a little memory freeing problem (with the list of free cline 
structs, if anyone knows what I'm talking about...). Also, in
addmatches() (a.k.a. almost compadd) the suffix-calculation could fail 
when used without matching.

Bye
 Sven

--- os/Zle/zle_tricky.c	Thu Feb 18 10:01:27 1999
+++ Src/Zle/zle_tricky.c	Thu Feb 18 15:40:36 1999
@@ -2716,6 +2716,8 @@
 	Cline f = freecl, q, op = NULL;
 	int ol, nl;
 
+	freecl = NULL;
+
 	while (o && n) {
 	    /* CLF_MID is set in the cline struct where the prefix and the
 	     * suffix from the line meet. If we have reached the cline
@@ -3777,7 +3779,7 @@
 	   char *suf, char *group, char *rems, char *remf, char *ign,
 	   int flags, int aflags, Cmatcher match, char **argv)
 {
-    char *s, *t, *e, *te, *ms, *lipre = NULL, *lpre, *lsuf, **aign = NULL;
+    char *s, *t, *e, *me, *te, *ms, *lipre = NULL, *lpre, *lsuf, **aign = NULL;
     int lpl, lsl, i, pl, sl, test, bpl, bsl, lsm, llpl;
     Aminfo ai;
     Cline lc = NULL;
@@ -3881,6 +3883,7 @@
 	    /* Walk through the matches given. */
 	    for (; (s = dupstring(*argv)); argv++) {
 		sl = strlen(s);
+		lc = NULL;
 		ms = NULL;
 		bpl = brpl;
 		bsl = brsl;
@@ -3917,9 +3920,10 @@
 			test = 1;
 		    if (!test)
 			continue;
-		    e = s + sl;
+		    me = e = s + sl;
 		} else {
 		    e = s;
+		    me = s + sl;
 		    pl = lpl;
 		}
 		/* Quoting? */
@@ -3941,7 +3945,7 @@
 		    t = dyncat(ppre, t);
 		if (!ms && mstack) {
 		    Cline *clp = &lc, tlc;
-		    char *ss = dupstring(s), *ee = e + (ss - s);
+		    char *ss = dupstring(s), *ee = me + (ss - s);
 
 		    if (lppre && *lppre) {
 			*clp = str_cline(lppre, strlen(lppre), &tlc);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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