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

PATCH: completion allocation



I doubt that any of this has anything to do with the problem reported
by Felix, which I think has to do with uninitialised memory.

All other uses of *alloc() initialise the allocated memory directly
after allocation. Hm.

Bye
 Sven

Index: Src/Zle/comp.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/comp.h,v
retrieving revision 1.3
diff -u -r1.3 comp.h
--- Src/Zle/comp.h	2000/05/02 10:31:11	1.3
+++ Src/Zle/comp.h	2000/05/05 12:01:26
@@ -65,6 +65,7 @@
     int num;			/* number of this group */
     int nbrbeg;			/* number of opened braces */
     int nbrend;			/* number of closed braces */
+    int new;			/* new matches since last permalloc() */
     /* The following is collected/used during listing. */
     int dcount;			/* number of matches to list in columns */
     int cols;			/* number of columns */
@@ -74,7 +75,6 @@
     int totl;			/* total length */
     int shortest;		/* length of shortest match */
     Cmgroup perm;		/* perm. alloced version of this group */
-    int new;			/* new matches since last permalloc() */
 };
 
 
Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.15
diff -u -r1.15 compcore.c
--- Src/Zle/compcore.c	2000/05/04 07:44:21	1.15
+++ Src/Zle/compcore.c	2000/05/05 12:01:27
@@ -2339,13 +2339,14 @@
     }
     mgroup = (Cmgroup) zhalloc(sizeof(struct cmgroup));
     mgroup->name = dupstring(n);
-    mgroup->lcount = mgroup->llcount = mgroup->mcount = 0;
+    mgroup->lcount = mgroup->llcount = mgroup->mcount = mgroup->ecount = 
+	mgroup->ccount = 0;
     mgroup->flags = flags;
     mgroup->matches = NULL;
     mgroup->ylist = NULL;
     mgroup->expls = NULL;
     mgroup->perm = NULL;
-    mgroup->new = 0;
+    mgroup->new = mgroup->num = mgroup->nbrbeg = mgroup->nbrend = 0;
 
     mgroup->lexpls = expls = newlinklist();
     mgroup->lmatches = matches = newlinklist();
@@ -2353,7 +2354,9 @@
 
     mgroup->lallccs = allccs = ((flags & CGF_NOSORT) ? NULL : newlinklist());
 
-    mgroup->next = amatches;
+    if ((mgroup->next = amatches))
+	amatches->prev = mgroup;
+    mgroup->prev = NULL;
     amatches = mgroup;
 }
 
@@ -2713,6 +2716,7 @@
 		for (eq = g->expls; (o = *eq); eq++, ep++) {
 		    *ep = e = (Cexpl) zcalloc(sizeof(struct cexpl));
 		    e->count = (fi ? o->fcount : o->count);
+		    e->fcount = 0;
 		    e->str = ztrdup(o->str);
 		}
 		*ep = NULL;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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