diff src/lread.c @ 39973:579177964efa

Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting with lisp system changes.
author Ken Raeburn <raeburn@raeburn.org>
date Tue, 16 Oct 2001 09:09:51 +0000
parents 6235c0f8e52c
children 19a89ce104dd
line wrap: on
line diff
--- a/src/lread.c	Mon Oct 15 20:52:59 2001 +0000
+++ b/src/lread.c	Tue Oct 16 09:09:51 2001 +0000
@@ -832,8 +832,8 @@
 
   GCPRO1 (file);
   lispstream = Fcons (Qnil, Qnil);
-  XSETFASTINT (XCAR (lispstream), (EMACS_UINT)stream >> 16);
-  XSETFASTINT (XCDR (lispstream), (EMACS_UINT)stream & 0xffff);
+  XSETCARFASTINT (lispstream, (EMACS_UINT)stream >> 16);
+  XSETCDRFASTINT (lispstream, (EMACS_UINT)stream & 0xffff);
   record_unwind_protect (load_unwind, lispstream);
   record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
   specbind (Qload_file_name, found);
@@ -963,16 +963,19 @@
   Lisp_Object string, tail;
   int max_suffix_len = 0;
 
-  for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
-    {
-      CHECK_STRING (XCAR (tail), 0);
-      max_suffix_len = max (max_suffix_len,
-			    STRING_BYTES (XSTRING (XCAR (tail))));
-    }
-
   string = filename = Qnil;
   GCPRO5 (str, string, filename, path, suffixes);
   
+  for (tail = suffixes; CONSP (tail); tail = XCDR (tail))
+    {
+      string = XCAR (tail);
+      CHECK_STRING (string, 0);
+      if (! EQ (string, XCAR (tail)))
+	XSETCAR (tail, string);
+      max_suffix_len = max (max_suffix_len,
+			    STRING_BYTES (XSTRING (string)));
+    }
+
   if (storeptr)
     *storeptr = Qnil;
 
@@ -2724,7 +2727,7 @@
 	    {
 	      GCPRO2 (val, tail);
 	      if (!NILP (tail))
-		XCDR (tail) = read0 (readcharfun);
+		XSETCDR (tail, read0 (readcharfun));
 	      else
 		val = read0 (readcharfun);
 	      read1 (readcharfun, &ch, 0);
@@ -2817,7 +2820,7 @@
 	     ? pure_cons (elt, Qnil)
 	     : Fcons (elt, Qnil));
       if (!NILP (tail))
-	XCDR (tail) = tem;
+	XSETCDR (tail, tem);
       else
 	val = tem;
       tail = tem;