diff --git a/src/hilight.c b/src/hilight.c index 60708811..46043b01 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -41,7 +41,7 @@ static unsigned int hi_hash(const char *tok) return hash; } -static struct hilight_hashentry *hilight_hash_free_entry(struct hilight_hashentry *entry) +static void hilight_hash_free_entry(struct hilight_hashentry *entry) { struct hilight_hashentry *tmp; while(entry) { @@ -51,7 +51,6 @@ static struct hilight_hashentry *hilight_hash_free_entry(struct hilight_hashentr my_free(757, &entry); entry = tmp; } - return NULL; } static void hilight_hash_free(void) /* remove the whole hash table */ @@ -61,7 +60,8 @@ static void hilight_hash_free(void) /* remove the whole hash table */ dbg(2, "hilight_hash_free(): removing hash table\n"); for(i=0;ihilight_table[i] = hilight_hash_free_entry( xctx->hilight_table[i] ); + hilight_hash_free_entry( xctx->hilight_table[i] ); + xctx->hilight_table[i] = NULL; } } diff --git a/src/move.c b/src/move.c index 9f1f4a12..c3a2118c 100644 --- a/src/move.c +++ b/src/move.c @@ -494,7 +494,7 @@ void find_inst_to_be_redrawn(int what) if(what & 16) { my_free(1202, &xctx->inst_redraw_table); xctx->inst_redraw_table_size = 0; - int_hash_free(xctx->node_redraw_table); + if((s_pnetname || xctx->hilight_nets)) int_hash_free(xctx->node_redraw_table); return; } if((s_pnetname || xctx->hilight_nets)) { diff --git a/src/node_hash.c b/src/node_hash.c index 883af212..9aef3646 100644 --- a/src/node_hash.c +++ b/src/node_hash.c @@ -164,7 +164,7 @@ struct node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, return ptr2; } -static struct node_hashentry *node_hash_free_entry(struct node_hashentry *entry) +static void node_hash_free_entry(struct node_hashentry *entry) { struct node_hashentry *tmp; @@ -179,7 +179,6 @@ static struct node_hashentry *node_hash_free_entry(struct node_hashentry *entry) my_free(867, &entry); entry = tmp; } - return NULL; } void node_hash_free(void) /* remove the whole hash table */ @@ -189,7 +188,8 @@ void node_hash_free(void) /* remove the whole hash table */ dbg(2, "node_hash_free(): removing hash table\n"); for(i=0;inode_table[i] = node_hash_free_entry( xctx->node_table[i] ); + node_hash_free_entry( xctx->node_table[i] ); + xctx->node_table[i] = NULL; } } diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 14b44c58..c777b816 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -615,7 +615,7 @@ struct str_hashentry *str_hash_lookup(struct str_hashentry **table, const char * } } -static struct str_hashentry *str_hash_free_entry(struct str_hashentry *entry) +static void str_hash_free_entry(struct str_hashentry *entry) { struct str_hashentry *tmp; while( entry ) { @@ -625,7 +625,6 @@ static struct str_hashentry *str_hash_free_entry(struct str_hashentry *entry) my_free(958, &entry); entry = tmp; } - return NULL; } @@ -635,7 +634,8 @@ void str_hash_free(struct str_hashentry **table) for(i=0;iinst[value].instname in hash table + * When inserting token must be set to xctx->inst[value].instname + * (return NULL if token was not found). If token was found update value + * as the table stores only the pointer to xctx->inst[value].instname + * 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 */ @@ -83,8 +85,7 @@ static struct inst_hashentry *inst_hash_lookup(char *token, int value, int what, *preventry=entry; entry->next=NULL; entry->hash=hashcode; - entry->token = my_malloc(426, token_size + 1); - memcpy(entry->token,token, token_size + 1); + entry->token = xctx->inst[value].instname; /* do not strdup, store pointer */ entry->value = value; } return NULL; /* token was not in hash */ @@ -92,7 +93,6 @@ static struct inst_hashentry *inst_hash_lookup(char *token, int value, int what, if( entry->hash==hashcode && !strcmp(token,entry->token) ) { /* found a matching token */ if(what == XDELETE) { /* remove token from the hash table ... */ saveptr=entry->next; - my_free(968, &entry->token); my_free(969, &entry); *preventry=saveptr; return NULL; @@ -107,28 +107,25 @@ static struct inst_hashentry *inst_hash_lookup(char *token, int value, int what, } } -static struct inst_hashentry *inst_hash_free_entry(struct inst_hashentry *entry) +static void inst_hash_free_entry(struct inst_hashentry *entry) { struct inst_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(970, &(entry->token)); - dbg(3, "inst_hash_free_entry(): removing entry %lu\n", (unsigned long)entry); my_free(971, &entry); entry = tmp; } - return NULL; } static void inst_hash_free(void) /* remove the whole hash table */ { - int i; + int i; - dbg(1, "inst_hash_free(): removing hash table\n"); - for(i=0;iinst_table[i] = inst_hash_free_entry( xctx->inst_table[i] ); - } + dbg(1, "inst_hash_free(): removing hash table\n"); + for(i=0;iinst_table[i] ); + xctx->inst_table[i] = NULL; + } } void hash_all_names(int n)