From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5579 invoked from network); 5 May 2000 12:04:40 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 May 2000 12:04:40 -0000 Received: (qmail 1951 invoked by alias); 5 May 2000 12:04:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11193 Received: (qmail 1936 invoked from network); 5 May 2000 12:04:33 -0000 Date: Fri, 5 May 2000 14:04:31 +0200 (MET DST) Message-Id: <200005051204.OAA02699@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: 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@informatik.hu-berlin.de