diff options
| author | Stefan Monnier | 2004-12-06 00:41:40 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-12-06 00:41:40 +0000 |
| commit | c72b0edd085ee95677140e78c42eb104f74a3354 (patch) | |
| tree | cbc7592716372cfe8178d8aca942bb2e4501cbeb /src/regex.c | |
| parent | 952cb0846a0f0e4faf4075180062f0e0e91b9170 (diff) | |
| download | emacs-c72b0edd085ee95677140e78c42eb104f74a3354.tar.gz emacs-c72b0edd085ee95677140e78c42eb104f74a3354.zip | |
(GET_UNSIGNED_NUMBER): Signal an error when reaching the end.
Remove redundant correctness checks.
(regex_compile): Fix up error codes for \{..\} expressions.
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/src/regex.c b/src/regex.c index 130765134f5..1009c837dcf 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1950,28 +1950,27 @@ struct range_table_work_area | |||
| 1950 | 1950 | ||
| 1951 | /* Get the next unsigned number in the uncompiled pattern. */ | 1951 | /* Get the next unsigned number in the uncompiled pattern. */ |
| 1952 | #define GET_UNSIGNED_NUMBER(num) \ | 1952 | #define GET_UNSIGNED_NUMBER(num) \ |
| 1953 | do { if (p != pend) \ | 1953 | do { \ |
| 1954 | { \ | 1954 | if (p == pend) \ |
| 1955 | PATFETCH (c); \ | 1955 | FREE_STACK_RETURN (REG_EBRACE); \ |
| 1956 | if (c == ' ') \ | 1956 | else \ |
| 1957 | FREE_STACK_RETURN (REG_BADBR); \ | 1957 | { \ |
| 1958 | while ('0' <= c && c <= '9') \ | 1958 | PATFETCH (c); \ |
| 1959 | { \ | 1959 | while ('0' <= c && c <= '9') \ |
| 1960 | int prev; \ | 1960 | { \ |
| 1961 | if (num < 0) \ | 1961 | int prev; \ |
| 1962 | num = 0; \ | 1962 | if (num < 0) \ |
| 1963 | prev = num; \ | 1963 | num = 0; \ |
| 1964 | num = num * 10 + c - '0'; \ | 1964 | prev = num; \ |
| 1965 | if (num / 10 != prev) \ | 1965 | num = num * 10 + c - '0'; \ |
| 1966 | FREE_STACK_RETURN (REG_BADBR); \ | 1966 | if (num / 10 != prev) \ |
| 1967 | if (p == pend) \ | 1967 | FREE_STACK_RETURN (REG_BADBR); \ |
| 1968 | break; \ | 1968 | if (p == pend) \ |
| 1969 | PATFETCH (c); \ | 1969 | FREE_STACK_RETURN (REG_EBRACE); \ |
| 1970 | } \ | 1970 | PATFETCH (c); \ |
| 1971 | if (c == ' ') \ | 1971 | } \ |
| 1972 | FREE_STACK_RETURN (REG_BADBR); \ | 1972 | } \ |
| 1973 | } \ | 1973 | } while (0) |
| 1974 | } while (0) | ||
| 1975 | 1974 | ||
| 1976 | #if ! WIDE_CHAR_SUPPORT | 1975 | #if ! WIDE_CHAR_SUPPORT |
| 1977 | 1976 | ||
| @@ -3234,9 +3233,6 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3234 | 3233 | ||
| 3235 | beg_interval = p; | 3234 | beg_interval = p; |
| 3236 | 3235 | ||
| 3237 | if (p == pend) | ||
| 3238 | FREE_STACK_RETURN (REG_EBRACE); | ||
| 3239 | |||
| 3240 | GET_UNSIGNED_NUMBER (lower_bound); | 3236 | GET_UNSIGNED_NUMBER (lower_bound); |
| 3241 | 3237 | ||
| 3242 | if (c == ',') | 3238 | if (c == ',') |
| @@ -3253,7 +3249,8 @@ regex_compile (pattern, size, syntax, bufp) | |||
| 3253 | { | 3249 | { |
| 3254 | if (c != '\\') | 3250 | if (c != '\\') |
| 3255 | FREE_STACK_RETURN (REG_BADBR); | 3251 | FREE_STACK_RETURN (REG_BADBR); |
| 3256 | 3252 | if (p == pend) | |
| 3253 | FREE_STACK_RETURN (REG_EESCAPE); | ||
| 3257 | PATFETCH (c); | 3254 | PATFETCH (c); |
| 3258 | } | 3255 | } |
| 3259 | 3256 | ||