(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
[bpt/emacs.git] / src / lread.c
index 77c7a3c..3e0bd1f 100644 (file)
@@ -5,10 +5,10 @@
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
@@ -1271,13 +1269,11 @@ Return t if the file exists and loads successfully.  */)
 
   UNGCPRO;
 
-  if (saved_doc_string)
-    free (saved_doc_string);
+  xfree (saved_doc_string);
   saved_doc_string = 0;
   saved_doc_string_size = 0;
 
-  if (prev_saved_doc_string)
-    xfree (prev_saved_doc_string);
+  xfree (prev_saved_doc_string);
   prev_saved_doc_string = 0;
   prev_saved_doc_string_size = 0;
 
@@ -3057,18 +3053,18 @@ substitute_object_in_subtree (object, placeholder)
 }
 
 /*  Feval doesn't get called from here, so no gc protection is needed. */
-#define SUBSTITUTE(get_val, set_val)                 \
-{                                                    \
-  Lisp_Object old_value = get_val;                   \
-  Lisp_Object true_value                             \
-    = substitute_object_recurse (object, placeholder,\
-                              old_value);           \
-                                                     \
-  if (!EQ (old_value, true_value))                   \
-    {                                                \
-       set_val;                                      \
-    }                                                \
-}
+#define SUBSTITUTE(get_val, set_val)                   \
+  do {                                                 \
+    Lisp_Object old_value = get_val;                   \
+    Lisp_Object true_value                             \
+      = substitute_object_recurse (object, placeholder,        \
+                                  old_value);          \
+                                                       \
+    if (!EQ (old_value, true_value))                   \
+      {                                                        \
+       set_val;                                        \
+      }                                                        \
+  } while (0)
 
 static Lisp_Object
 substitute_object_recurse (object, placeholder, subtree)
@@ -3097,23 +3093,33 @@ substitute_object_recurse (object, placeholder, subtree)
     {
     case Lisp_Vectorlike:
       {
-       int i;
-       int length = XINT (Flength(subtree));
+       int i, length = 0;
+       if (BOOL_VECTOR_P (subtree))
+         return subtree;               /* No sub-objects anyway.  */
+       else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
+                || COMPILEDP (subtree))
+         length = ASIZE (subtree) & PSEUDOVECTOR_SIZE_MASK;
+       else if (VECTORP (subtree))
+         length = ASIZE (subtree);
+       else
+         /* An unknown pseudovector may contain non-Lisp fields, so we
+            can't just blindly traverse all its fields.  We used to call
+            `Flength' which signalled `sequencep', so I just preserved this
+            behavior.  */
+         wrong_type_argument (Qsequencep, subtree);
+
        for (i = 0; i < length; i++)
-         {
-           Lisp_Object idx = make_number (i);
-           SUBSTITUTE (Faref (subtree, idx),
-                       Faset (subtree, idx, true_value));
-         }
+         SUBSTITUTE (AREF (subtree, i),
+                     ASET (subtree, i, true_value));
        return subtree;
       }
 
     case Lisp_Cons:
       {
-       SUBSTITUTE (Fcar_safe (subtree),
-                   Fsetcar (subtree, true_value));
-       SUBSTITUTE (Fcdr_safe (subtree),
-                   Fsetcdr (subtree, true_value));
+       SUBSTITUTE (XCAR (subtree),
+                   XSETCAR (subtree, true_value));
+       SUBSTITUTE (XCDR (subtree),
+                   XSETCDR (subtree, true_value));
        return subtree;
       }