diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2001-05-15 16:32:22 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2001-05-15 16:32:22 +0000 |
commit | eb71464b09eb01014934ede89c031f8acddff6b8 (patch) | |
tree | 824f7c04c0f84b26056c081a903d4f82a9d12bb4 /Src/hashtable.c | |
parent | 90e59f2e74903a678b53ae2005d721d88d72187e (diff) | |
download | zsh-eb71464b09eb01014934ede89c031f8acddff6b8.tar.gz zsh-eb71464b09eb01014934ede89c031f8acddff6b8.tar.xz zsh-eb71464b09eb01014934ede89c031f8acddff6b8.zip |
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).
Diffstat (limited to 'Src/hashtable.c')
-rw-r--r-- | Src/hashtable.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; |