summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-12-08 22:20:27 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-12-08 22:20:27 +0000
commitfad2f6858075f49c4c8fd16f0535c287e3f14ac3 (patch)
tree843a2ffe6caea6201877e3d2f1b6b954f47344b5 /src/regex.c
parent856dd47583918edd7987c13334703d3e7492d8f4 (diff)
parentb11e88237593ff7556d8535305e8f342e6b61d66 (diff)
downloademacs-fad2f6858075f49c4c8fd16f0535c287e3f14ac3.tar.gz
emacs-fad2f6858075f49c4c8fd16f0535c287e3f14ac3.tar.bz2
emacs-fad2f6858075f49c4c8fd16f0535c287e3f14ac3.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-714 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-271
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/src/regex.c b/src/regex.c
index a53eac29216..1009c837dcf 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1950,28 +1950,27 @@ struct range_table_work_area
/* Get the next unsigned number in the uncompiled pattern. */
#define GET_UNSIGNED_NUMBER(num) \
- do { if (p != pend) \
- { \
- PATFETCH (c); \
- if (c == ' ') \
- FREE_STACK_RETURN (REG_BADBR); \
- while ('0' <= c && c <= '9') \
- { \
- int prev; \
- if (num < 0) \
- num = 0; \
- prev = num; \
- num = num * 10 + c - '0'; \
- if (num / 10 != prev) \
- FREE_STACK_RETURN (REG_BADBR); \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- if (c == ' ') \
- FREE_STACK_RETURN (REG_BADBR); \
- } \
- } while (0)
+ do { \
+ if (p == pend) \
+ FREE_STACK_RETURN (REG_EBRACE); \
+ else \
+ { \
+ PATFETCH (c); \
+ while ('0' <= c && c <= '9') \
+ { \
+ int prev; \
+ if (num < 0) \
+ num = 0; \
+ prev = num; \
+ num = num * 10 + c - '0'; \
+ if (num / 10 != prev) \
+ FREE_STACK_RETURN (REG_BADBR); \
+ if (p == pend) \
+ FREE_STACK_RETURN (REG_EBRACE); \
+ PATFETCH (c); \
+ } \
+ } \
+ } while (0)
#if ! WIDE_CHAR_SUPPORT
@@ -2558,8 +2557,8 @@ regex_compile (pattern, size, syntax, bufp)
}
/* If the spaces are followed by a repetition op,
treat them normally. */
- if (p1 == pend
- || (*p1 == '*' || *p1 == '+' || *p1 == '?'
+ if (p1 != pend
+ && (*p1 == '*' || *p1 == '+' || *p1 == '?'
|| (*p1 == '\\' && p1 + 1 != pend && p1[1] == '{')))
goto normal_char;
@@ -3234,9 +3233,6 @@ regex_compile (pattern, size, syntax, bufp)
beg_interval = p;
- if (p == pend)
- FREE_STACK_RETURN (REG_EBRACE);
-
GET_UNSIGNED_NUMBER (lower_bound);
if (c == ',')
@@ -3253,7 +3249,8 @@ regex_compile (pattern, size, syntax, bufp)
{
if (c != '\\')
FREE_STACK_RETURN (REG_BADBR);
-
+ if (p == pend)
+ FREE_STACK_RETURN (REG_EESCAPE);
PATFETCH (c);
}