From eb71464b09eb01014934ede89c031f8acddff6b8 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 15 May 2001 16:32:22 +0000 Subject: Changed addhistnode() to not displace an already-hashed command with one that is marked HIST_TMPSTORE. Also changed the function to not ever destroy the entry we're currently adding (the caller now destroys the newly-added entry, if it so desires). --- Src/hashtable.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Src/hashtable.c') diff --git a/Src/hashtable.c b/Src/hashtable.c index 884c98412..e88bc2477 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -1480,10 +1480,11 @@ addhistnode(HashTable ht, char *nam, void *nodeptr) HashNode oldnode = addhashnode2(ht, nam, nodeptr); Histent he = (Histent)nodeptr; if (oldnode && oldnode != (HashNode)nodeptr) { - if (he->flags & HIST_MAKEUNIQUE + if (he->flags & (HIST_MAKEUNIQUE | HIST_TMPSTORE) || (he->flags & HIST_FOREIGN && (Histent)oldnode == he->up)) { + (void) addhashnode2(ht, oldnode->nam, oldnode); /* restore hash */ he->flags |= HIST_DUP; - addhashnode(ht, oldnode->nam, oldnode); /* Remove the new dup */ + he->flags &= ~HIST_MAKEUNIQUE; } else { oldnode->flags |= HIST_DUP; -- cgit 1.4.1