misc + remove useless escaping in bracket

This commit is contained in:
Kyryl Melekhin
2021-08-10 11:02:35 +00:00
parent 6a3be3927e
commit 83f0a4d6f9
3 changed files with 7 additions and 12 deletions

12
pike.c
View File

@@ -86,8 +86,7 @@ enum
enum {
RE_SUCCESS = 0,
RE_SYNTAX_ERROR = -2,
RE_UNSUPPORTED_ESCAPE = -3,
RE_UNSUPPORTED_SYNTAX = -4,
RE_UNSUPPORTED_SYNTAX = -3,
};
typedef struct rsub rsub;
@@ -229,12 +228,6 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
prog->len++;
for (cnt = 0; *re != ']'; cnt++) {
if (!*re) goto syntax_error;
if (*re == '\\') {
re++;
if (!*re) goto syntax_error;
if (*re != '\\' && *re != ']')
goto unsupported_escape;
}
uc_code(c, re) EMIT(PC++, c);
uc_len(c, re)
if (re[c] == '-' && re[c+1] != ']')
@@ -398,9 +391,6 @@ static int _compilecode(const char **re_loc, rcode *prog, int sizecode)
syntax_error:
*re_loc = re;
return RE_SYNTAX_ERROR;
unsupported_escape:
*re_loc = re;
return RE_UNSUPPORTED_ESCAPE;
}
int re_sizecode(const char *re)