mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 18:52:35 +02:00
commit bash-20170303 snapshot
This commit is contained in:
+4
-2
@@ -361,8 +361,10 @@ BRACKMATCH (p, test, flags)
|
||||
int brcnt, forcecoll;
|
||||
INT pc;
|
||||
CHAR *savep;
|
||||
U_CHAR orig_test;
|
||||
|
||||
test = FOLD (test);
|
||||
orig_test = test;
|
||||
test = FOLD (orig_test);
|
||||
|
||||
savep = p;
|
||||
|
||||
@@ -427,7 +429,7 @@ BRACKMATCH (p, test, flags)
|
||||
{
|
||||
bcopy (p + 1, ccname, (close - p - 1) * sizeof (CHAR));
|
||||
*(ccname + (close - p - 1)) = L('\0');
|
||||
pc = IS_CCLASS (test, (XCHAR *)ccname);
|
||||
pc = IS_CCLASS (orig_test, (XCHAR *)ccname);
|
||||
}
|
||||
if (pc == -1)
|
||||
pc = 0;
|
||||
|
||||
+32
-8
@@ -144,25 +144,33 @@ static char const *const cclass_name[] =
|
||||
|
||||
#define N_CHAR_CLASS (sizeof(cclass_name) / sizeof (cclass_name[0]))
|
||||
|
||||
static int
|
||||
is_cclass (c, name)
|
||||
int c;
|
||||
static enum char_class
|
||||
is_valid_cclass (name)
|
||||
const char *name;
|
||||
{
|
||||
enum char_class char_class = CC_NO_CLASS;
|
||||
int i, result;
|
||||
enum char_class ret;
|
||||
int i;
|
||||
|
||||
ret = CC_NO_CLASS;
|
||||
|
||||
for (i = 1; i < N_CHAR_CLASS; i++)
|
||||
{
|
||||
if (STREQ (name, cclass_name[i]))
|
||||
{
|
||||
char_class = (enum char_class)i;
|
||||
ret = (enum char_class)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (char_class == 0)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
cclass_test (c, char_class)
|
||||
int c;
|
||||
enum char_class char_class;
|
||||
{
|
||||
int result;
|
||||
|
||||
switch (char_class)
|
||||
{
|
||||
@@ -215,6 +223,22 @@ is_cclass (c, name)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
is_cclass (c, name)
|
||||
int c;
|
||||
const char *name;
|
||||
{
|
||||
enum char_class char_class;
|
||||
int result;
|
||||
|
||||
char_class = is_valid_cclass (name);
|
||||
if (char_class == CC_NO_CLASS)
|
||||
return -1;
|
||||
|
||||
result = cclass_test (c, char_class);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Now include `sm_loop.c' for single-byte characters. */
|
||||
/* The result of FOLD is an `unsigned char' */
|
||||
|
||||
Reference in New Issue
Block a user