From: David Kastrup Date: Fri, 11 Jun 2004 00:08:37 +0000 (+0000) Subject: (match_limit): Don't flag an error if match-data X-Git-Tag: ttn-vms-21-2-B4~5840 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9b9ceb6178003e97157f14dfcf2eee832b6fb6a2;p=emacs.git (match_limit): Don't flag an error if match-data exceeding the allocated search_regs.num_regs gets requested, just return Qnil. --- diff --git a/src/ChangeLog b/src/ChangeLog index d6750648fd5..98e0b46bc37 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2004-06-11 David Kastrup + + * search.c (match_limit): Don't flag an error if match-data + exceeding the allocated search_regs.num_regs gets requested, just + return Qnil. + 2004-06-08 Miles Bader * xfaces.c (push_named_merge_point): Return 0 when a cycle is detected. diff --git a/src/search.c b/src/search.c index e5e4c3f867a..24f21f053a5 100644 --- a/src/search.c +++ b/src/search.c @@ -2622,9 +2622,9 @@ match_limit (num, beginningp) CHECK_NUMBER (num); n = XINT (num); - if (n < 0 || n >= search_regs.num_regs) + if (n < 0 || search_regs.num_regs <= 0) args_out_of_range (num, make_number (search_regs.num_regs)); - if (search_regs.num_regs <= 0 + if (n >= search_regs.num_regs || search_regs.start[n] < 0) return Qnil; return (make_number ((beginningp) ? search_regs.start[n]