Blame SOURCES/bash-4.4-patch-9.patch

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