fix regression: hilight/rename duplicated instance names was no more functional

This commit is contained in:
Stefan Schippers 2020-09-23 00:58:39 +02:00
parent 5186d3b92c
commit 39b7a441b3
3 changed files with 6 additions and 3 deletions

View File

@ -437,6 +437,7 @@ static unsigned int hash(const char *tok)
* "whatever" "whatever" XINSERT insert in hash table if not in.
* if already present update value if not NULL,
* return entry address.
* "whatever" "whatever" XINSERT_NOREPLACE same as XINSERT but do not replace existing value
* return NULL if not found.
* "whatever" "whatever" XLOOKUP lookup in hash table,return entry addr.
* return NULL if not found
@ -457,7 +458,7 @@ struct hashentry *hash_lookup(struct hashentry **table, const char *token, const
{
if( !entry ) /* empty slot */
{
if(what==XINSERT) /* insert data */
if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */
{
s=sizeof( struct hashentry );
entry=(struct hashentry *)my_malloc(313, s);

View File

@ -75,6 +75,7 @@ int name_strcmp(char *s, char *d) /* compare strings up to '\0' or'[' */
/* remove:
* 0,XINSERT : lookup and insert in hash table (return NULL if token was not found)
* if token was found update value
3,XINSERT_NOREPLACE : same as XINSERT but do not replace existing value if token found.
* 1,XDELETE : delete token entry, return NULL
* 2,XLOOKUP : lookup only
*/
@ -92,7 +93,7 @@ static struct inst_hashentry *inst_hash_lookup(struct inst_hashentry **table, ch
preventry=&table[index];
while(1) {
if( !entry ) { /* empty slot */
if(remove == XINSERT) { /* insert data */
if(remove == XINSERT || remove == XINSERT_NOREPLACE) { /* insert data */
s=sizeof( struct inst_hashentry );
entry=(struct inst_hashentry *) my_malloc(425, s);
*preventry=entry;
@ -198,7 +199,7 @@ void check_unique_names(int rename)
comma_pos = strchr(start, ',');
if(comma_pos) *comma_pos = '\0';
dbg(1, "check_unique_names: checking %s\n", start);
if( (entry = inst_hash_lookup(table, start, i, XINSERT, strlen(start)) ) && entry->value != i) {
if( (entry = inst_hash_lookup(table, start, i, XINSERT_NOREPLACE, strlen(start)) ) && entry->value != i) {
inst_ptr[i].flags |=4;
hilight_nets=1;
if(rename == 1) {

View File

@ -238,6 +238,7 @@ extern char win_temp_dir[PATH_MAX];
#define XINSERT 0
#define XLOOKUP 1
#define XDELETE 2
#define XINSERT_NOREPLACE 3 /* do not replace token value in hash if already present */
#define S(a) (sizeof(a)/sizeof(char))
#define BUS_WIDTH 4