Merge pull request #4940 from diizzyy/patch-95
[feed/packages.git] / utils / bash / patches / 109-upstream-bash44-009.patch
1 Index: bash-4.4/lib/readline/history.c
2 ===================================================================
3 --- bash-4.4.orig/lib/readline/history.c
4 +++ bash-4.4/lib/readline/history.c
5 @@ -279,6 +279,7 @@ add_history (string)
6 const char *string;
7 {
8 HIST_ENTRY *temp;
9 + int new_length;
10
11 if (history_stifled && (history_length == history_max_entries))
12 {
13 @@ -295,13 +296,9 @@ add_history (string)
14
15 /* Copy the rest of the entries, moving down one slot. Copy includes
16 trailing NULL. */
17 -#if 0
18 - for (i = 0; i < history_length; i++)
19 - the_history[i] = the_history[i + 1];
20 -#else
21 memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
22 -#endif
23
24 + new_length = history_length;
25 history_base++;
26 }
27 else
28 @@ -315,7 +312,7 @@ add_history (string)
29 else
30 history_size = DEFAULT_HISTORY_INITIAL_SIZE;
31 the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
32 - history_length = 1;
33 + new_length = 1;
34 }
35 else
36 {
37 @@ -325,14 +322,15 @@ add_history (string)
38 the_history = (HIST_ENTRY **)
39 xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
40 }
41 - history_length++;
42 + new_length = history_length + 1;
43 }
44 }
45
46 temp = alloc_history_entry ((char *)string, hist_inittime ());
47
48 - the_history[history_length] = (HIST_ENTRY *)NULL;
49 - the_history[history_length - 1] = temp;
50 + the_history[new_length] = (HIST_ENTRY *)NULL;
51 + the_history[new_length - 1] = temp;
52 + history_length = new_length;
53 }
54
55 /* Change the time stamp of the most recent history entry to STRING. */
56 Index: bash-4.4/patchlevel.h
57 ===================================================================
58 --- bash-4.4.orig/patchlevel.h
59 +++ bash-4.4/patchlevel.h
60 @@ -25,6 +25,6 @@
61 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
62 looks for to find the patch level (for the sccs version string). */
63
64 -#define PATCHLEVEL 8
65 +#define PATCHLEVEL 9
66
67 #endif /* _PATCHLEVEL_H_ */