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