summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2017-01-29 13:55:34 -0500
committerChet Ramey <chet.ramey@case.edu>2017-01-29 13:55:34 -0500
commite3f5a97bfa54db0d4e4fe67e406e64f1a58508ea (patch)
treef1c7e8b74f05abfaa324b6d83bbfd3793f5a4f49
parentacf3951d483e7b3478db4d731f4a8af99d27327d (diff)
downloadreadline-e3f5a97bfa54db0d4e4fe67e406e64f1a58508ea.tar.gz
Readline-7.0 patch 2
-rw-r--r--history.c16
-rw-r--r--patchlevel2
2 files changed, 8 insertions, 10 deletions
diff --git a/history.c b/history.c
index 9ff25a7..129c57a 100644
--- a/history.c
+++ b/history.c
@@ -279,6 +279,7 @@ add_history (string)
const char *string;
{
HIST_ENTRY *temp;
+ int new_length;
if (history_stifled && (history_length == history_max_entries))
{
@@ -295,13 +296,9 @@ add_history (string)
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
-#if 0
- for (i = 0; i < history_length; i++)
- the_history[i] = the_history[i + 1];
-#else
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
-#endif
+ new_length = history_length;
history_base++;
}
else
@@ -315,7 +312,7 @@ add_history (string)
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
- history_length = 1;
+ new_length = 1;
}
else
{
@@ -325,14 +322,15 @@ add_history (string)
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
- history_length++;
+ new_length = history_length + 1;
}
}
temp = alloc_history_entry ((char *)string, hist_inittime ());
- the_history[history_length] = (HIST_ENTRY *)NULL;
- the_history[history_length - 1] = temp;
+ the_history[new_length] = (HIST_ENTRY *)NULL;
+ the_history[new_length - 1] = temp;
+ history_length = new_length;
}
/* Change the time stamp of the most recent history entry to STRING. */
diff --git a/patchlevel b/patchlevel
index fdf4740..7cbda82 100644
--- a/patchlevel
+++ b/patchlevel
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-1
+2