nalika / rpms / bash

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