From 04118530d4157d3494349e2628246b78465e08f8 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Fri, 5 May 2000 12:06:21 +0000 Subject: some more memory initialisation after allocation; shouldn't possibly have done any harm (11193) --- ChangeLog | 6 ++++++ Src/Zle/comp.h | 2 +- Src/Zle/compcore.c | 10 +++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f92ba468..1d65f5ad1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-05-05 Sven Wischnowsky + + * 11193: Src/Zle/comp.h, Src/Zle/compcore.c: some more memory + initialisation after allocation; shouldn't possibly have done any + harm + 2000-05-05 Tanaka Akira * 11190: Completion/User/_look: new completion for look. diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h index 9239fbee0..3b49b2c25 100644 --- a/Src/Zle/comp.h +++ b/Src/Zle/comp.h @@ -65,6 +65,7 @@ struct cmgroup { 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 @@ struct cmgroup { 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() */ }; diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c index 542c5eebc..e04973b0a 100644 --- a/Src/Zle/compcore.c +++ b/Src/Zle/compcore.c @@ -2339,13 +2339,14 @@ begcmgroup(char *n, int flags) } 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 @@ begcmgroup(char *n, int flags) 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 @@ permmatches(int last) 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; -- cgit 1.4.1