3fb13f
From e59fb114e9c0436890d110cfdda4d794a63496e7 Mon Sep 17 00:00:00 2001
3fb13f
From: Chet Ramey <chet.ramey@case.edu>
3fb13f
Date: Fri, 20 Jan 2017 15:38:29 -0500
3fb13f
Subject: [PATCH] Bash-4.4 patch 9
3fb13f
3fb13f
---
3fb13f
 lib/readline/history.c | 16 +++++++---------
3fb13f
 patchlevel.h           |  2 +-
3fb13f
 2 files changed, 8 insertions(+), 10 deletions(-)
3fb13f
3fb13f
diff --git a/lib/readline/history.c b/lib/readline/history.c
3fb13f
index 9ff25a7..129c57a 100644
3fb13f
--- a/lib/readline/history.c
3fb13f
+++ b/lib/readline/history.c
3fb13f
@@ -279,6 +279,7 @@ add_history (string)
3fb13f
      const char *string;
3fb13f
 {
3fb13f
   HIST_ENTRY *temp;
3fb13f
+  int new_length;
3fb13f
 
3fb13f
   if (history_stifled && (history_length == history_max_entries))
3fb13f
     {
3fb13f
@@ -295,13 +296,9 @@ add_history (string)
3fb13f
 
3fb13f
       /* Copy the rest of the entries, moving down one slot.  Copy includes
3fb13f
 	 trailing NULL.  */
3fb13f
-#if 0
3fb13f
-      for (i = 0; i < history_length; i++)
3fb13f
-	the_history[i] = the_history[i + 1];
3fb13f
-#else
3fb13f
       memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
3fb13f
-#endif
3fb13f
 
3fb13f
+      new_length = history_length;
3fb13f
       history_base++;
3fb13f
     }
3fb13f
   else
3fb13f
@@ -315,7 +312,7 @@ add_history (string)
3fb13f
 	  else
3fb13f
 	    history_size = DEFAULT_HISTORY_INITIAL_SIZE;
3fb13f
 	  the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
3fb13f
-	  history_length = 1;
3fb13f
+	  new_length = 1;
3fb13f
 	}
3fb13f
       else
3fb13f
 	{
3fb13f
@@ -325,14 +322,15 @@ add_history (string)
3fb13f
 	      the_history = (HIST_ENTRY **)
3fb13f
 		xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
3fb13f
 	    }
3fb13f
-	  history_length++;
3fb13f
+	  new_length = history_length + 1;
3fb13f
 	}
3fb13f
     }
3fb13f
 
3fb13f
   temp = alloc_history_entry ((char *)string, hist_inittime ());
3fb13f
 
3fb13f
-  the_history[history_length] = (HIST_ENTRY *)NULL;
3fb13f
-  the_history[history_length - 1] = temp;
3fb13f
+  the_history[new_length] = (HIST_ENTRY *)NULL;
3fb13f
+  the_history[new_length - 1] = temp;
3fb13f
+  history_length = new_length;
3fb13f
 }
3fb13f
 
3fb13f
 /* Change the time stamp of the most recent history entry to STRING. */
3fb13f
diff --git a/patchlevel.h b/patchlevel.h
3fb13f
index 16c8740..02f1d60 100644
3fb13f
--- a/patchlevel.h
3fb13f
+++ b/patchlevel.h
3fb13f
@@ -25,6 +25,6 @@
3fb13f
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
3fb13f
    looks for to find the patch level (for the sccs version string). */
3fb13f
 
3fb13f
-#define PATCHLEVEL 8
3fb13f
+#define PATCHLEVEL 9
3fb13f
 
3fb13f
 #endif /* _PATCHLEVEL_H_ */
3fb13f
-- 
3fb13f
2.9.3
3fb13f