mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 16:39:53 +02:00
commit bash-20160923 snapshot
This commit is contained in:
+2
-2
@@ -390,10 +390,10 @@ xstrmatch (pattern, string, flags)
|
||||
wchar_t *wpattern, *wstring;
|
||||
size_t plen, slen, mplen, mslen;
|
||||
|
||||
if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0)
|
||||
if (MB_CUR_MAX == 1)
|
||||
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
|
||||
|
||||
if (MB_CUR_MAX == 1)
|
||||
if (mbsmbchar (string) == 0 && mbsmbchar (pattern) == 0)
|
||||
return (internal_strmatch ((unsigned char *)pattern, (unsigned char *)string, flags));
|
||||
|
||||
n = xdupmbstowcs (&wpattern, NULL, pattern);
|
||||
|
||||
@@ -57,6 +57,8 @@ extern int errno;
|
||||
/* How big to make the_history when we first allocate it. */
|
||||
#define DEFAULT_HISTORY_INITIAL_SIZE 502
|
||||
|
||||
#define MAX_HISTORY_INITIAL_SIZE 8192
|
||||
|
||||
/* The number of slots to increase the_history by. */
|
||||
#define DEFAULT_HISTORY_GROW_SIZE 50
|
||||
|
||||
@@ -307,7 +309,9 @@ add_history (string)
|
||||
if (history_size == 0)
|
||||
{
|
||||
if (history_stifled && history_max_entries > 0)
|
||||
history_size = history_max_entries + 2;
|
||||
history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
|
||||
? MAX_HISTORY_INITIAL_SIZE
|
||||
: history_max_entries + 2;
|
||||
else
|
||||
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
|
||||
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
#include "rlprivate.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#define MAX_MACRO_LEVEL 16
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Hacking Keyboard Macros */
|
||||
@@ -83,12 +85,21 @@ struct saved_macro {
|
||||
/* The list of saved macros. */
|
||||
static struct saved_macro *macro_list = (struct saved_macro *)NULL;
|
||||
|
||||
static int macro_level = 0;
|
||||
|
||||
/* Set up to read subsequent input from STRING.
|
||||
STRING is free ()'ed when we are done with it. */
|
||||
void
|
||||
_rl_with_macro_input (string)
|
||||
char *string;
|
||||
{
|
||||
if (macro_level > MAX_MACRO_LEVEL)
|
||||
{
|
||||
_rl_errmsg ("maximum macro execution nesting level exceeded");
|
||||
_rl_abort_internal ();
|
||||
return;
|
||||
}
|
||||
|
||||
_rl_push_executing_macro ();
|
||||
rl_executing_macro = string;
|
||||
executing_macro_index = 0;
|
||||
@@ -146,6 +157,8 @@ _rl_push_executing_macro ()
|
||||
saver->string = rl_executing_macro;
|
||||
|
||||
macro_list = saver;
|
||||
|
||||
macro_level++;
|
||||
}
|
||||
|
||||
/* Discard the current macro, replacing it with the one
|
||||
@@ -168,6 +181,8 @@ _rl_pop_executing_macro ()
|
||||
xfree (macro);
|
||||
}
|
||||
|
||||
macro_level--;
|
||||
|
||||
if (rl_executing_macro == 0)
|
||||
RL_UNSETSTATE(RL_STATE_MACROINPUT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user