|
|
6d8091 |
From e3f5a97bfa54db0d4e4fe67e406e64f1a58508ea Mon Sep 17 00:00:00 2001
|
|
|
6d8091 |
From: Chet Ramey <chet.ramey@case.edu>
|
|
|
6d8091 |
Date: Sun, 29 Jan 2017 13:55:34 -0500
|
|
|
6d8091 |
Subject: [PATCH] Readline-7.0 patch 2
|
|
|
6d8091 |
|
|
|
6d8091 |
---
|
|
|
6d8091 |
history.c | 16 +++++++---------
|
|
|
6d8091 |
patchlevel | 2 +-
|
|
|
6d8091 |
2 files changed, 8 insertions(+), 10 deletions(-)
|
|
|
6d8091 |
|
|
|
6d8091 |
diff --git a/history.c b/history.c
|
|
|
6d8091 |
index 9ff25a7..129c57a 100644
|
|
|
6d8091 |
--- a/history.c
|
|
|
6d8091 |
+++ b/history.c
|
|
|
6d8091 |
@@ -279,6 +279,7 @@ add_history (string)
|
|
|
6d8091 |
const char *string;
|
|
|
6d8091 |
{
|
|
|
6d8091 |
HIST_ENTRY *temp;
|
|
|
6d8091 |
+ int new_length;
|
|
|
6d8091 |
|
|
|
6d8091 |
if (history_stifled && (history_length == history_max_entries))
|
|
|
6d8091 |
{
|
|
|
6d8091 |
@@ -295,13 +296,9 @@ add_history (string)
|
|
|
6d8091 |
|
|
|
6d8091 |
/* Copy the rest of the entries, moving down one slot. Copy includes
|
|
|
6d8091 |
trailing NULL. */
|
|
|
6d8091 |
-#if 0
|
|
|
6d8091 |
- for (i = 0; i < history_length; i++)
|
|
|
6d8091 |
- the_history[i] = the_history[i + 1];
|
|
|
6d8091 |
-#else
|
|
|
6d8091 |
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
|
|
|
6d8091 |
-#endif
|
|
|
6d8091 |
|
|
|
6d8091 |
+ new_length = history_length;
|
|
|
6d8091 |
history_base++;
|
|
|
6d8091 |
}
|
|
|
6d8091 |
else
|
|
|
6d8091 |
@@ -315,7 +312,7 @@ add_history (string)
|
|
|
6d8091 |
else
|
|
|
6d8091 |
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
|
|
|
6d8091 |
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
|
|
|
6d8091 |
- history_length = 1;
|
|
|
6d8091 |
+ new_length = 1;
|
|
|
6d8091 |
}
|
|
|
6d8091 |
else
|
|
|
6d8091 |
{
|
|
|
6d8091 |
@@ -325,14 +322,15 @@ add_history (string)
|
|
|
6d8091 |
the_history = (HIST_ENTRY **)
|
|
|
6d8091 |
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
|
|
|
6d8091 |
}
|
|
|
6d8091 |
- history_length++;
|
|
|
6d8091 |
+ new_length = history_length + 1;
|
|
|
6d8091 |
}
|
|
|
6d8091 |
}
|
|
|
6d8091 |
|
|
|
6d8091 |
temp = alloc_history_entry ((char *)string, hist_inittime ());
|
|
|
6d8091 |
|
|
|
6d8091 |
- the_history[history_length] = (HIST_ENTRY *)NULL;
|
|
|
6d8091 |
- the_history[history_length - 1] = temp;
|
|
|
6d8091 |
+ the_history[new_length] = (HIST_ENTRY *)NULL;
|
|
|
6d8091 |
+ the_history[new_length - 1] = temp;
|
|
|
6d8091 |
+ history_length = new_length;
|
|
|
6d8091 |
}
|
|
|
6d8091 |
|
|
|
6d8091 |
/* Change the time stamp of the most recent history entry to STRING. */
|
|
|
6d8091 |
diff --git a/patchlevel b/patchlevel
|
|
|
6d8091 |
index fdf4740..7cbda82 100644
|
|
|
6d8091 |
--- a/patchlevel
|
|
|
6d8091 |
+++ b/patchlevel
|
|
|
6d8091 |
@@ -1,3 +1,3 @@
|
|
|
6d8091 |
# Do not edit -- exists only for use by patch
|
|
|
6d8091 |
|
|
|
6d8091 |
-1
|
|
|
6d8091 |
+2
|
|
|
6d8091 |
--
|
|
|
6d8091 |
2.13.6
|
|
|
6d8091 |
|