Since allowing brackets to be part of cell names in a previous

commit, found that DBTreeFindUse fails to find such uses because
it strips the array delimiters off the name.  Fixed the routine
although the routine really should be checking if the use is a
1- or 2- dimensional array and stripping off only the components
expected.  The current code will probably fail for cell uses
that have brackets in the name AND are arrayed.  Fortunately
this search routine does not appear to be used frequently or in
any critical database functions like netlisting.
This commit is contained in:
Tim Edwards 2019-08-20 10:37:12 -04:00
parent 942eaf8113
commit aa4bb4b19c
1 changed files with 17 additions and 10 deletions

View File

@ -296,18 +296,25 @@ DBTreeFindUse(name, use, scx)
if ((def->cd_flags & CDAVAILABLE) == 0)
(void) DBCellRead(def, (char *) NULL, TRUE, NULL);
/*
* Pull off the next component of path up to but not including
* any array subscripts.
*/
for (cp = name; *cp && *cp != '[' && *cp != '/'; cp++)
/* Nothing */;
csave = *cp;
*cp = '\0';
he = HashLookOnly(&def->cd_idHash, name);
*cp = csave;
if (he == NULL || HashGetValue(he) == NULL)
return;
{
/*
* Pull off the next component of path up to but not including
* any array subscripts.
* NOTE: This should check the array bounds and only remove
* array components that are expected, not array components
* embedded in the name.
*/
for (cp = name; *cp && *cp != '[' && *cp != '/'; cp++)
/* Nothing */;
csave = *cp;
*cp = '\0';
he = HashLookOnly(&def->cd_idHash, name);
*cp = csave;
if (he == NULL || HashGetValue(he) == NULL)
return;
}
use = (CellUse *) HashGetValue(he);
def = use->cu_def;