1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-31 03:04:49 +01:00

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).
This commit is contained in:
Wayne Davison 2001-05-15 16:32:22 +00:00
parent 90e59f2e74
commit eb71464b09

View file

@ -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;