|
|
97c6af7 |
From 1c6ae703b3ecd79427572d3f2741e034e07a7267 Mon Sep 17 00:00:00 2001
|
|
|
97c6af7 |
From: Fridolin Pokorny <fpokorny@redhat.com>
|
|
|
97c6af7 |
Date: Wed, 27 Aug 2014 13:52:59 +0200
|
|
|
97c6af7 |
Subject: [PATCH 10/14] merge histlist properly
|
|
|
97c6af7 |
|
|
|
97c6af7 |
Resolves: #919452
|
|
|
97c6af7 |
|
|
|
97c6af7 |
---
|
|
|
97c6af7 |
sh.hist.c | 8 ++++----
|
|
|
97c6af7 |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
97c6af7 |
|
|
|
97c6af7 |
diff --git a/sh.hist.c b/sh.hist.c
|
|
|
97c6af7 |
index 7e53c65..2e47eaa 100644
|
|
|
97c6af7 |
--- a/sh.hist.c
|
|
|
97c6af7 |
+++ b/sh.hist.c
|
|
|
bed5d53 |
@@ -99,7 +99,7 @@ hremove(struct Hist *hp)
|
|
|
bed5d53 |
|
|
|
bed5d53 |
/* Prune length of history list to specified size by history variable. */
|
|
|
bed5d53 |
PG_STATIC void
|
|
|
bed5d53 |
-discardExcess(int histlen)
|
|
|
bed5d53 |
+discardExcess(int histlen, int flg)
|
|
|
bed5d53 |
{
|
|
|
bed5d53 |
struct Hist *hp, *np;
|
|
|
bed5d53 |
if (histTail == NULL) {
|
|
|
bed5d53 |
@@ -110,13 +110,13 @@ discardExcess(int histlen)
|
|
|
bed5d53 |
* the list is still too long scan the whole list as before. But only do a
|
|
|
bed5d53 |
* full scan if the list is more than 6% (1/16th) too long. */
|
|
|
bed5d53 |
while (histCount > (unsigned)histlen && (np = Histlist.Hnext)) {
|
|
|
bed5d53 |
- if (eventno - np->Href >= histlen || histlen == 0)
|
|
|
bed5d53 |
+ if ((eventno - np->Href >= histlen || histlen == 0) && ! (flg & HIST_MERGE))
|
|
|
bed5d53 |
hremove(np), hfree(np);
|
|
|
bed5d53 |
else
|
|
|
bed5d53 |
break;
|
|
|
bed5d53 |
}
|
|
|
bed5d53 |
while (histCount > (unsigned)histlen && (np = histTail) != &Histlist) {
|
|
|
bed5d53 |
- if (eventno - np->Href >= histlen || histlen == 0)
|
|
|
bed5d53 |
+ if ((eventno - np->Href >= histlen || histlen == 0) || flg & HIST_MERGE)
|
|
|
bed5d53 |
hremove(np), hfree(np);
|
|
|
bed5d53 |
else
|
|
|
bed5d53 |
break;
|
|
|
bed5d53 |
@@ -153,7 +153,7 @@ savehist(
|
|
|
bed5d53 |
}
|
|
|
bed5d53 |
if (sp)
|
|
|
bed5d53 |
(void) enthist(++eventno, sp, 1, flg, histlen);
|
|
|
bed5d53 |
- discardExcess(histlen);
|
|
|
bed5d53 |
+ discardExcess(histlen, flg);
|
|
|
bed5d53 |
}
|
|
|
bed5d53 |
|
|
|
bed5d53 |
#define USE_JENKINS_HASH 1
|
|
|
97c6af7 |
--
|
|
|
97c6af7 |
1.9.3
|
|
|
97c6af7 |
|