diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-26 00:07:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-26 00:20:30 -0700 |
commit | 438975bbaa25b7de74993e7928c45cf5779442b8 (patch) | |
tree | df469c5d4e1e3d51c9868514ce6444f129d3059a /src/regex-emacs.c | |
parent | b64d04c3d63d009ffeb801a128a39e3728ff9a99 (diff) | |
download | emacs-438975bbaa25b7de74993e7928c45cf5779442b8.tar.gz |
regex-emacs omit POS runtime check
* src/regex-emacs.c (re_match_2_internal): Replace unnecessary
runtime check of POS with some eassumes.
Diffstat (limited to 'src/regex-emacs.c')
-rw-r--r-- | src/regex-emacs.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/regex-emacs.c b/src/regex-emacs.c index c44cce9f787..954a193371a 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -3864,6 +3864,10 @@ re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string2, ptrdiff_t size2, ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop) { + eassume (0 <= size1); + eassume (0 <= size2); + eassume (0 <= pos && pos <= stop && stop <= size1 + size2); + /* General temporaries. */ int mcnt; @@ -3979,14 +3983,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, best_regend = best_regstart + num_regs; } - /* The starting position is bogus. */ - if (pos < 0 || pos > size1 + size2) - { - unbind_to (count, Qnil); - SAFE_FREE (); - return -1; - } - /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. */ for (ptrdiff_t reg = 1; reg < num_regs; reg++) |