changeset 56276:b04610e283ce

(Fset_match_data): Allow buffer before end of list which can happen if set-match-data is using a pre-consed list.
author David Kastrup <dak@gnu.org>
date Tue, 29 Jun 2004 02:37:52 +0000
parents c9dc6eff7664
children fd126130c3cd
files src/ChangeLog src/search.c
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Jun 28 23:15:42 2004 +0000
+++ b/src/ChangeLog	Tue Jun 29 02:37:52 2004 +0000
@@ -1,3 +1,8 @@
+2004-06-29  David Kastrup  <dak@gnu.org>
+
+	* search.c (Fset_match_data): Allow buffer before end of list
+	which can happen if set-match-data is using a pre-consed list.
+
 2004-06-28  Steven Tamm  <tamm@Steven-Tamms-Computer.local>
 
 	* macterm.c (XTread_socket): Correctly set the frame position
--- a/src/search.c	Mon Jun 28 23:15:42 2004 +0000
+++ b/src/search.c	Tue Jun 29 02:37:52 2004 +0000
@@ -2808,9 +2808,16 @@
 	search_regs.num_regs = length;
       }
 
-    for (i = 0; i < length; i++)
+    for (i = 0;; i++)
       {
 	marker = Fcar (list);
+	if (BUFFERP(marker))
+	  {
+	    XSETBUFFER(last_thing_searched, marker);
+	    break;
+	  }
+	if (i >= length)
+	  break;
 	if (NILP (marker))
 	  {
 	    search_regs.start[i] = -1;
@@ -2847,10 +2854,6 @@
       search_regs.start[i] = -1;
   }
 
-  if (CONSP(list) && BUFFERP(XCAR(list))) {
-    XSETBUFFER(last_thing_searched, XCAR(list));
-  }
-
   return Qnil;
 }