aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2020-08-26 00:07:08 -0700
committerPaul Eggert2020-08-26 00:20:30 -0700
commit438975bbaa25b7de74993e7928c45cf5779442b8 (patch)
treedf469c5d4e1e3d51c9868514ce6444f129d3059a /src
parentb64d04c3d63d009ffeb801a128a39e3728ff9a99 (diff)
downloademacs-438975bbaa25b7de74993e7928c45cf5779442b8.tar.gz
emacs-438975bbaa25b7de74993e7928c45cf5779442b8.zip
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')
-rw-r--r--src/regex-emacs.c12
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,
3864 re_char *string2, ptrdiff_t size2, 3864 re_char *string2, ptrdiff_t size2,
3865 ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop) 3865 ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop)
3866{ 3866{
3867 eassume (0 <= size1);
3868 eassume (0 <= size2);
3869 eassume (0 <= pos && pos <= stop && stop <= size1 + size2);
3870
3867 /* General temporaries. */ 3871 /* General temporaries. */
3868 int mcnt; 3872 int mcnt;
3869 3873
@@ -3979,14 +3983,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
3979 best_regend = best_regstart + num_regs; 3983 best_regend = best_regstart + num_regs;
3980 } 3984 }
3981 3985
3982 /* The starting position is bogus. */
3983 if (pos < 0 || pos > size1 + size2)
3984 {
3985 unbind_to (count, Qnil);
3986 SAFE_FREE ();
3987 return -1;
3988 }
3989
3990 /* Initialize subexpression text positions to -1 to mark ones that no 3986 /* Initialize subexpression text positions to -1 to mark ones that no
3991 start_memory/stop_memory has been seen for. */ 3987 start_memory/stop_memory has been seen for. */
3992 for (ptrdiff_t reg = 1; reg < num_regs; reg++) 3988 for (ptrdiff_t reg = 1; reg < num_regs; reg++)