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:
parent
90e59f2e74
commit
eb71464b09
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue