Drop FGET and revert read access to Lisp_Objects slots of struct frame.
[bpt/emacs.git] / src / data.c
index 4b342c0..3a8e0b1 100644 (file)
@@ -83,12 +83,12 @@ Lisp_Object Qoverflow_error, Qunderflow_error;
 Lisp_Object Qfloatp;
 Lisp_Object Qnumberp, Qnumber_or_marker_p;
 
-Lisp_Object Qinteger;
-static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
+Lisp_Object Qinteger, Qinterval, Qfloat, Qvector;
+Lisp_Object Qsymbol, Qstring, Qcons, Qmisc;
 Lisp_Object Qwindow;
-static Lisp_Object Qfloat, Qwindow_configuration;
-static Lisp_Object Qprocess;
-static Lisp_Object Qcompiled_function, Qframe, Qvector;
+static Lisp_Object Qoverlay, Qwindow_configuration;
+static Lisp_Object Qprocess, Qmarker;
+static Lisp_Object Qcompiled_function, Qframe;
 Lisp_Object Qbuffer;
 static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
 static Lisp_Object Qsubrp, Qmany, Qunevalled;
@@ -562,7 +562,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt);
+  return (EQ (SVAR (XSYMBOL (symbol), function), Qunbound) ? Qnil : Qt);
 }
 
 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -585,7 +585,7 @@ Return SYMBOL.  */)
   CHECK_SYMBOL (symbol);
   if (NILP (symbol) || EQ (symbol, Qt))
     xsignal1 (Qsetting_constant, symbol);
-  XSYMBOL (symbol)->function = Qunbound;
+  SVAR (XSYMBOL (symbol), function) = Qunbound;
   return symbol;
 }
 
@@ -594,8 +594,8 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  if (!EQ (XSYMBOL (symbol)->function, Qunbound))
-    return XSYMBOL (symbol)->function;
+  if (!EQ (SVAR (XSYMBOL (symbol), function), Qunbound))
+    return SVAR (XSYMBOL (symbol), function);
   xsignal1 (Qvoid_function, symbol);
 }
 
@@ -604,7 +604,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return XSYMBOL (symbol)->plist;
+  return SVAR (XSYMBOL (symbol), plist);
 }
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -628,7 +628,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
   if (NILP (symbol) || EQ (symbol, Qt))
     xsignal1 (Qsetting_constant, symbol);
 
-  function = XSYMBOL (symbol)->function;
+  function = SVAR (XSYMBOL (symbol), function);
 
   if (!NILP (Vautoload_queue) && !EQ (function, Qunbound))
     Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -636,13 +636,13 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
   if (CONSP (function) && EQ (XCAR (function), Qautoload))
     Fput (symbol, Qautoload, XCDR (function));
 
-  XSYMBOL (symbol)->function = definition;
+  SVAR (XSYMBOL (symbol), function) = definition;
   /* Handle automatic advice activation.  */
-  if (CONSP (XSYMBOL (symbol)->plist)
+  if (CONSP (SVAR (XSYMBOL (symbol), plist))
       && !NILP (Fget (symbol, Qad_advice_info)))
     {
       call2 (Qad_activate_internal, symbol, Qnil);
-      definition = XSYMBOL (symbol)->function;
+      definition = SVAR (XSYMBOL (symbol), function);
     }
   return definition;
 }
@@ -657,8 +657,8 @@ The return value is undefined.  */)
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
-  if (CONSP (XSYMBOL (symbol)->function)
-      && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
+  if (CONSP (SVAR (XSYMBOL (symbol), function))
+      && EQ (XCAR (SVAR (XSYMBOL (symbol), function)), Qautoload))
     LOADHIST_ATTACH (Fcons (Qt, symbol));
   if (!NILP (Vpurify_flag)
       /* If `definition' is a keymap, immutable (and copying) is wrong.  */
@@ -679,7 +679,7 @@ DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
   (register Lisp_Object symbol, Lisp_Object newplist)
 {
   CHECK_SYMBOL (symbol);
-  XSYMBOL (symbol)->plist = newplist;
+  SVAR (XSYMBOL (symbol), plist) = newplist;
   return newplist;
 }
 
@@ -761,7 +761,7 @@ Value, if non-nil, is a list \(interactive SPEC).  */)
        {
          struct gcpro gcpro1;
          GCPRO1 (cmd);
-         do_autoload (fun, cmd);
+         Fautoload_do_load (fun, cmd, Qnil);
          UNGCPRO;
          return Finteractive_form (cmd);
        }
@@ -928,7 +928,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
        Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
 
        if (!(NILP (type) || NILP (newval)
-             || (XINT (type) == LISP_INT_TAG
+             || (XINT (type) == Lisp_Int0
                  ? INTEGERP (newval)
                  : XTYPE (newval) == XINT (type))))
          buffer_slot_type_mismatch (newval, XINT (type));
@@ -1401,7 +1401,7 @@ for this variable.  */)
              {
                struct buffer *b;
 
-               for (b = all_buffers; b; b = b->header.next.buffer)
+               FOR_EACH_BUFFER (b)
                  if (!PER_BUFFER_VALUE_P (b, idx))
                    PER_BUFFER_VALUE (b, offset) = value;
              }
@@ -2019,12 +2019,12 @@ indirect_function (register Lisp_Object object)
     {
       if (!SYMBOLP (hare) || EQ (hare, Qunbound))
        break;
-      hare = XSYMBOL (hare)->function;
+      hare = SVAR (XSYMBOL (hare), function);
       if (!SYMBOLP (hare) || EQ (hare, Qunbound))
        break;
-      hare = XSYMBOL (hare)->function;
+      hare = SVAR (XSYMBOL (hare), function);
 
-      tortoise = XSYMBOL (tortoise)->function;
+      tortoise = SVAR (XSYMBOL (tortoise), function);
 
       if (EQ (hare, tortoise))
        xsignal1 (Qcyclic_function_indirection, object);
@@ -2048,7 +2048,7 @@ function chain of symbols.  */)
   /* Optimize for no indirection.  */
   result = object;
   if (SYMBOLP (result) && !EQ (result, Qunbound)
-      && (result = XSYMBOL (result)->function, SYMBOLP (result)))
+      && (result = SVAR (XSYMBOL (result), function), SYMBOLP (result)))
     result = indirect_function (result);
   if (!EQ (result, Qunbound))
     return result;
@@ -2059,7 +2059,7 @@ function chain of symbols.  */)
   return Qnil;
 }
 \f
-/* Extract and set vector and string elements */
+/* Extract and set vector and string elements */
 
 DEFUN ("aref", Faref, Saref, 2, 2, 0,
        doc: /* Return the element of ARRAY at index IDX.
@@ -2179,10 +2179,9 @@ bool-vector.  IDX starts at 0.  */)
            {
              /* We must relocate the string data.  */
              ptrdiff_t nchars = SCHARS (array);
-             unsigned char *str;
              USE_SAFE_ALLOCA;
+             unsigned char *str = SAFE_ALLOCA (nbytes);
 
-             SAFE_ALLOCA (str, unsigned char *, nbytes);
              memcpy (str, SDATA (array), nbytes);
              allocate_string_data (XSTRING (array), nchars,
                                    nbytes + new_bytes - prev_bytes);
@@ -2522,7 +2521,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
   ptrdiff_t ok_args;
   EMACS_INT ok_accum;
 
-  switch (SWITCH_ENUM_CAST (code))
+  switch (code)
     {
     case Alogior:
     case Alogxor:
@@ -2557,7 +2556,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
                                   nargs, args);
       args[argnum] = val;
       next = XINT (args[argnum]);
-      switch (SWITCH_ENUM_CAST (code))
+      switch (code)
        {
        case Aadd:
          if (INT_ADD_OVERFLOW (accum, next))
@@ -2643,7 +2642,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code,
          args[argnum] = val;    /* runs into a compiler bug. */
          next = XINT (args[argnum]);
        }
-      switch (SWITCH_ENUM_CAST (code))
+      switch (code)
        {
        case Aadd:
          accum += next;
@@ -3083,7 +3082,6 @@ syms_of_data (void)
   DEFSYM (Qwindow_configuration, "window-configuration");
   DEFSYM (Qprocess, "process");
   DEFSYM (Qwindow, "window");
-  /* DEFSYM (Qsubr, "subr"); */
   DEFSYM (Qcompiled_function, "compiled-function");
   DEFSYM (Qbuffer, "buffer");
   DEFSYM (Qframe, "frame");
@@ -3091,6 +3089,9 @@ syms_of_data (void)
   DEFSYM (Qchar_table, "char-table");
   DEFSYM (Qbool_vector, "bool-vector");
   DEFSYM (Qhash_table, "hash-table");
+  /* Used by Fgarbage_collect.  */
+  DEFSYM (Qinterval, "interval");
+  DEFSYM (Qmisc, "misc");
 
   DEFSYM (Qdefun, "defun");
 
@@ -3195,7 +3196,7 @@ syms_of_data (void)
   defsubr (&Ssubr_arity);
   defsubr (&Ssubr_name);
 
-  XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;
+  SVAR (XSYMBOL (Qwholenump), function) = SVAR (XSYMBOL (Qnatnump), function);
 
   DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
               doc: /* The largest value that is representable in a Lisp integer.  */);