Corrected a bad error from a few commits ago, probably 198, which

can deallocate the cell name and causes all sorts of unexpected and
unwanted behavior.
This commit is contained in:
Tim Edwards
2020-03-21 12:40:35 -04:00
parent fe8e229920
commit 276bf1d78a
19 changed files with 41 additions and 44 deletions
+9 -9
View File
@@ -1245,14 +1245,12 @@ DBCellLookDef(cellName)
*/
CellDef *
DBCellNewDef(cellName, cellFileName)
DBCellNewDef(cellName)
char *cellName; /* Name by which the cell is known */
char *cellFileName; /* Name of disk file in which the cell
* should be kept when written out.
*/
{
CellDef *cellDef;
HashEntry *entry;
char *dotptr;
if (cellName == (char *) NULL)
cellName = UNNAMED;
@@ -1264,10 +1262,12 @@ DBCellNewDef(cellName, cellFileName)
cellDef = DBCellDefAlloc();
HashSetValue(entry, (ClientData) cellDef);
cellDef->cd_name = StrDup((char **) NULL, cellName);
if (cellFileName == (char *) NULL)
cellDef->cd_file = cellFileName;
else
cellDef->cd_file = StrDup((char **) NULL, cellFileName);
/* Strip any .mag extension off of the cell name */
dotptr = strrchr(cellDef->cd_name, '.');
if (dotptr && !strcmp(dotptr, ".mag")) *dotptr = '\0';
cellDef->cd_file = NULL;
return (cellDef);
}
@@ -2081,7 +2081,7 @@ DBNewYank(yname, pyuse, pydef)
*pydef = DBCellLookDef(yname);
if (*pydef == (CellDef *) NULL)
{
*pydef = DBCellNewDef (yname,(char *) NULL);
*pydef = DBCellNewDef(yname);
ASSERT(*pydef != (CellDef *) NULL, "DBNewYank");
DBCellSetAvail(*pydef);
(*pydef)->cd_flags |= CDINTERNAL;
+2 -2
View File
@@ -859,7 +859,7 @@ DBReadBackup(name)
cellDef = DBCellLookDef(rootname);
if (cellDef == (CellDef *)NULL)
cellDef = DBCellNewDef(rootname, (char *)NULL);
cellDef = DBCellNewDef(rootname);
cellDef->cd_flags &= ~CDNOTFOUND;
cellDef->cd_flags |= CDAVAILABLE;
@@ -1352,7 +1352,7 @@ badTransform:
subCellDef = DBCellLookDef(cellname);
if (subCellDef == (CellDef *) NULL)
{
subCellDef = DBCellNewDef(cellname, (char *)NULL);
subCellDef = DBCellNewDef(cellname);
subCellDef->cd_timestamp = childStamp;
/* Make sure rectangle is non-degenerate */