diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2020-12-04 18:37:21 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2020-12-04 18:39:13 +0100 |
commit | 7bdc40e8d10488745355376981793a4d1e823f19 (patch) | |
tree | 315d6ea4a1f76dcbff4fc8ab4dae21d44719f458 /src/search.c | |
parent | a5fa79d50e6e6182fef0a6dc526ac272e87e2c02 (diff) | |
download | emacs-7bdc40e8d10488745355376981793a4d1e823f19.tar.gz emacs-7bdc40e8d10488745355376981793a4d1e823f19.tar.bz2 emacs-7bdc40e8d10488745355376981793a4d1e823f19.zip |
Speed up match-substitute-replacement
* lisp/subr.el (match-substitute-replacement): Use match-data--translate.
* src/search.c (Fmatch_data__translate): Remove string restriction.
* test/lisp/subr-tests.el (subr-match-substitute-replacement): New test.
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/search.c b/src/search.c index 4eb634a3c03..50d82fd289d 100644 --- a/src/search.c +++ b/src/search.c @@ -3033,12 +3033,12 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) DEFUN ("match-data--translate", Fmatch_data__translate, Smatch_data__translate, 1, 1, 0, - doc: /* Add N to all string positions in the match data. Internal. */) + doc: /* Add N to all positions in the match data. Internal. */) (Lisp_Object n) { CHECK_FIXNUM (n); EMACS_INT delta = XFIXNUM (n); - if (EQ (last_thing_searched, Qt)) /* String match data only. */ + if (!NILP (last_thing_searched)) for (ptrdiff_t i = 0; i < search_regs.num_regs; i++) if (search_regs.start[i] >= 0) { |