Fix two bugs in null suffix handling. Both occured only after the suffix
list was cleared. Rules with null suffixes would not be rebuilt when the suffixes were added again. Adding null suffix rules would fail when a rule for the same source was declared before the suffix list was cleared. PR: 23328, 24102 Reviewed by: will Approved by: rwatson
This commit is contained in:
parent
98e6d79157
commit
aa2af82f77
@ -460,8 +460,16 @@ Suff_ClearSuffixes ()
|
||||
{
|
||||
Lst_Concat (suffClean, sufflist, LST_CONCLINK);
|
||||
sufflist = Lst_Init(FALSE);
|
||||
sNum = 0;
|
||||
sNum = 1;
|
||||
suffNull = emptySuff;
|
||||
/*
|
||||
* Clear suffNull's children list (the other suffixes are built new, but
|
||||
* suffNull is used as is).
|
||||
* NOFREE is used because all suffixes are are on the suffClean list.
|
||||
* suffNull should not have parents.
|
||||
*/
|
||||
Lst_Destroy(suffNull->children, NOFREE);
|
||||
suffNull->children = Lst_Init(FALSE);
|
||||
}
|
||||
|
||||
/*-
|
||||
@ -714,20 +722,25 @@ SuffRebuildGraph(transformp, sp)
|
||||
Suff *s = (Suff *) sp;
|
||||
char *cp;
|
||||
LstNode ln;
|
||||
Suff *s2;
|
||||
Suff *s2 = NULL;
|
||||
|
||||
/*
|
||||
* First see if it is a transformation from this suffix.
|
||||
*/
|
||||
cp = SuffStrIsPrefix(s->name, transform->name);
|
||||
if (cp != (char *)NULL) {
|
||||
ln = Lst_Find(sufflist, (void *)cp, SuffSuffHasNameP);
|
||||
if (ln != NULL) {
|
||||
if (cp[0] == '\0') /* null rule */
|
||||
s2 = suffNull;
|
||||
else {
|
||||
ln = Lst_Find(sufflist, (void *)cp, SuffSuffHasNameP);
|
||||
if (ln != NULL)
|
||||
s2 = (Suff *)Lst_Datum(ln);
|
||||
}
|
||||
if (s2 != NULL) {
|
||||
/*
|
||||
* Found target. Link in and return, since it can't be anything
|
||||
* else.
|
||||
*/
|
||||
s2 = (Suff *)Lst_Datum(ln);
|
||||
SuffInsert(s2->children, s);
|
||||
SuffInsert(s->parents, s2);
|
||||
return(0);
|
||||
@ -2359,7 +2372,7 @@ static int SuffPrintName(s, dummy)
|
||||
void * s;
|
||||
void * dummy;
|
||||
{
|
||||
printf ("%s ", ((Suff *) s)->name);
|
||||
printf ("`%s' ", ((Suff *) s)->name);
|
||||
return (dummy ? 0 : 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user