aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/src/data.c b/src/data.c
index 4b342c0f521..d0ef5734abc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -83,12 +83,12 @@ Lisp_Object Qoverflow_error, Qunderflow_error;
83Lisp_Object Qfloatp; 83Lisp_Object Qfloatp;
84Lisp_Object Qnumberp, Qnumber_or_marker_p; 84Lisp_Object Qnumberp, Qnumber_or_marker_p;
85 85
86Lisp_Object Qinteger; 86Lisp_Object Qinteger, Qinterval, Qfloat, Qvector;
87static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay; 87Lisp_Object Qsymbol, Qstring, Qcons, Qmisc;
88Lisp_Object Qwindow; 88Lisp_Object Qwindow;
89static Lisp_Object Qfloat, Qwindow_configuration; 89static Lisp_Object Qoverlay, Qwindow_configuration;
90static Lisp_Object Qprocess; 90static Lisp_Object Qprocess, Qmarker;
91static Lisp_Object Qcompiled_function, Qframe, Qvector; 91static Lisp_Object Qcompiled_function, Qframe;
92Lisp_Object Qbuffer; 92Lisp_Object Qbuffer;
93static Lisp_Object Qchar_table, Qbool_vector, Qhash_table; 93static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
94static Lisp_Object Qsubrp, Qmany, Qunevalled; 94static Lisp_Object Qsubrp, Qmany, Qunevalled;
@@ -562,7 +562,7 @@ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
562 (register Lisp_Object symbol) 562 (register Lisp_Object symbol)
563{ 563{
564 CHECK_SYMBOL (symbol); 564 CHECK_SYMBOL (symbol);
565 return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt); 565 return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt;
566} 566}
567 567
568DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, 568DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -585,7 +585,7 @@ Return SYMBOL. */)
585 CHECK_SYMBOL (symbol); 585 CHECK_SYMBOL (symbol);
586 if (NILP (symbol) || EQ (symbol, Qt)) 586 if (NILP (symbol) || EQ (symbol, Qt))
587 xsignal1 (Qsetting_constant, symbol); 587 xsignal1 (Qsetting_constant, symbol);
588 XSYMBOL (symbol)->function = Qunbound; 588 set_symbol_function (symbol, Qunbound);
589 return symbol; 589 return symbol;
590} 590}
591 591
@@ -636,7 +636,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
636 if (CONSP (function) && EQ (XCAR (function), Qautoload)) 636 if (CONSP (function) && EQ (XCAR (function), Qautoload))
637 Fput (symbol, Qautoload, XCDR (function)); 637 Fput (symbol, Qautoload, XCDR (function));
638 638
639 XSYMBOL (symbol)->function = definition; 639 set_symbol_function (symbol, definition);
640 /* Handle automatic advice activation. */ 640 /* Handle automatic advice activation. */
641 if (CONSP (XSYMBOL (symbol)->plist) 641 if (CONSP (XSYMBOL (symbol)->plist)
642 && !NILP (Fget (symbol, Qad_advice_info))) 642 && !NILP (Fget (symbol, Qad_advice_info)))
@@ -679,7 +679,7 @@ DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
679 (register Lisp_Object symbol, Lisp_Object newplist) 679 (register Lisp_Object symbol, Lisp_Object newplist)
680{ 680{
681 CHECK_SYMBOL (symbol); 681 CHECK_SYMBOL (symbol);
682 XSYMBOL (symbol)->plist = newplist; 682 set_symbol_plist (symbol, newplist);
683 return newplist; 683 return newplist;
684} 684}
685 685
@@ -761,7 +761,7 @@ Value, if non-nil, is a list \(interactive SPEC). */)
761 { 761 {
762 struct gcpro gcpro1; 762 struct gcpro gcpro1;
763 GCPRO1 (cmd); 763 GCPRO1 (cmd);
764 do_autoload (fun, cmd); 764 Fautoload_do_load (fun, cmd, Qnil);
765 UNGCPRO; 765 UNGCPRO;
766 return Finteractive_form (cmd); 766 return Finteractive_form (cmd);
767 } 767 }
@@ -808,10 +808,12 @@ indirect_variable (struct Lisp_Symbol *symbol)
808 808
809DEFUN ("indirect-variable", Findirect_variable, Sindirect_variable, 1, 1, 0, 809DEFUN ("indirect-variable", Findirect_variable, Sindirect_variable, 1, 1, 0,
810 doc: /* Return the variable at the end of OBJECT's variable chain. 810 doc: /* Return the variable at the end of OBJECT's variable chain.
811If OBJECT is a symbol, follow all variable indirections and return the final 811If OBJECT is a symbol, follow its variable indirections (if any), and
812variable. If OBJECT is not a symbol, just return it. 812return the variable at the end of the chain of aliases. See Info node
813Signal a cyclic-variable-indirection error if there is a loop in the 813`(elisp)Variable Aliases'.
814variable chain of symbols. */) 814
815If OBJECT is not a symbol, just return it. If there is a loop in the
816chain of aliases, signal a `cyclic-variable-indirection' error. */)
815 (Lisp_Object object) 817 (Lisp_Object object)
816{ 818{
817 if (SYMBOLP (object)) 819 if (SYMBOLP (object))
@@ -928,7 +930,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
928 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; 930 Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype;
929 931
930 if (!(NILP (type) || NILP (newval) 932 if (!(NILP (type) || NILP (newval)
931 || (XINT (type) == LISP_INT_TAG 933 || (XINT (type) == Lisp_Int0
932 ? INTEGERP (newval) 934 ? INTEGERP (newval)
933 : XTYPE (newval) == XINT (type)))) 935 : XTYPE (newval) == XINT (type))))
934 buffer_slot_type_mismatch (newval, XINT (type)); 936 buffer_slot_type_mismatch (newval, XINT (type));
@@ -1211,8 +1213,8 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1211 bindings, not for frame-local bindings. */ 1213 bindings, not for frame-local bindings. */
1212 eassert (!blv->frame_local); 1214 eassert (!blv->frame_local);
1213 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1215 tem1 = Fcons (symbol, XCDR (blv->defcell));
1214 BVAR (XBUFFER (where), local_var_alist) 1216 BSET (XBUFFER (where), local_var_alist,
1215 = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)); 1217 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1216 } 1218 }
1217 } 1219 }
1218 1220
@@ -1401,7 +1403,7 @@ for this variable. */)
1401 { 1403 {
1402 struct buffer *b; 1404 struct buffer *b;
1403 1405
1404 for (b = all_buffers; b; b = b->header.next.buffer) 1406 FOR_EACH_BUFFER (b)
1405 if (!PER_BUFFER_VALUE_P (b, idx)) 1407 if (!PER_BUFFER_VALUE_P (b, idx))
1406 PER_BUFFER_VALUE (b, offset) = value; 1408 PER_BUFFER_VALUE (b, offset) = value;
1407 } 1409 }
@@ -1651,9 +1653,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1651 default value. */ 1653 default value. */
1652 find_symbol_value (variable); 1654 find_symbol_value (variable);
1653 1655
1654 BVAR (current_buffer, local_var_alist) 1656 BSET (current_buffer, local_var_alist,
1655 = Fcons (Fcons (variable, XCDR (blv->defcell)), 1657 Fcons (Fcons (variable, XCDR (blv->defcell)),
1656 BVAR (current_buffer, local_var_alist)); 1658 BVAR (current_buffer, local_var_alist)));
1657 1659
1658 /* Make sure symbol does not think it is set up for this buffer; 1660 /* Make sure symbol does not think it is set up for this buffer;
1659 force it to look once again for this buffer's value. */ 1661 force it to look once again for this buffer's value. */
@@ -1721,8 +1723,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1721 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1722 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1723 if (!NILP (tem)) 1725 if (!NILP (tem))
1724 BVAR (current_buffer, local_var_alist) 1726 BSET (current_buffer, local_var_alist,
1725 = Fdelq (tem, BVAR (current_buffer, local_var_alist)); 1727 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1726 1728
1727 /* If the symbol is set up with the current buffer's binding 1729 /* If the symbol is set up with the current buffer's binding
1728 loaded, recompute its value. We have to do it now, or else 1730 loaded, recompute its value. We have to do it now, or else
@@ -2059,7 +2061,7 @@ function chain of symbols. */)
2059 return Qnil; 2061 return Qnil;
2060} 2062}
2061 2063
2062/* Extract and set vector and string elements */ 2064/* Extract and set vector and string elements. */
2063 2065
2064DEFUN ("aref", Faref, Saref, 2, 2, 0, 2066DEFUN ("aref", Faref, Saref, 2, 2, 0,
2065 doc: /* Return the element of ARRAY at index IDX. 2067 doc: /* Return the element of ARRAY at index IDX.
@@ -2179,10 +2181,9 @@ bool-vector. IDX starts at 0. */)
2179 { 2181 {
2180 /* We must relocate the string data. */ 2182 /* We must relocate the string data. */
2181 ptrdiff_t nchars = SCHARS (array); 2183 ptrdiff_t nchars = SCHARS (array);
2182 unsigned char *str;
2183 USE_SAFE_ALLOCA; 2184 USE_SAFE_ALLOCA;
2185 unsigned char *str = SAFE_ALLOCA (nbytes);
2184 2186
2185 SAFE_ALLOCA (str, unsigned char *, nbytes);
2186 memcpy (str, SDATA (array), nbytes); 2187 memcpy (str, SDATA (array), nbytes);
2187 allocate_string_data (XSTRING (array), nchars, 2188 allocate_string_data (XSTRING (array), nchars,
2188 nbytes + new_bytes - prev_bytes); 2189 nbytes + new_bytes - prev_bytes);
@@ -2522,7 +2523,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2522 ptrdiff_t ok_args; 2523 ptrdiff_t ok_args;
2523 EMACS_INT ok_accum; 2524 EMACS_INT ok_accum;
2524 2525
2525 switch (SWITCH_ENUM_CAST (code)) 2526 switch (code)
2526 { 2527 {
2527 case Alogior: 2528 case Alogior:
2528 case Alogxor: 2529 case Alogxor:
@@ -2557,7 +2558,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
2557 nargs, args); 2558 nargs, args);
2558 args[argnum] = val; 2559 args[argnum] = val;
2559 next = XINT (args[argnum]); 2560 next = XINT (args[argnum]);
2560 switch (SWITCH_ENUM_CAST (code)) 2561 switch (code)
2561 { 2562 {
2562 case Aadd: 2563 case Aadd:
2563 if (INT_ADD_OVERFLOW (accum, next)) 2564 if (INT_ADD_OVERFLOW (accum, next))
@@ -2643,7 +2644,7 @@ float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code,
2643 args[argnum] = val; /* runs into a compiler bug. */ 2644 args[argnum] = val; /* runs into a compiler bug. */
2644 next = XINT (args[argnum]); 2645 next = XINT (args[argnum]);
2645 } 2646 }
2646 switch (SWITCH_ENUM_CAST (code)) 2647 switch (code)
2647 { 2648 {
2648 case Aadd: 2649 case Aadd:
2649 accum += next; 2650 accum += next;
@@ -3083,7 +3084,6 @@ syms_of_data (void)
3083 DEFSYM (Qwindow_configuration, "window-configuration"); 3084 DEFSYM (Qwindow_configuration, "window-configuration");
3084 DEFSYM (Qprocess, "process"); 3085 DEFSYM (Qprocess, "process");
3085 DEFSYM (Qwindow, "window"); 3086 DEFSYM (Qwindow, "window");
3086 /* DEFSYM (Qsubr, "subr"); */
3087 DEFSYM (Qcompiled_function, "compiled-function"); 3087 DEFSYM (Qcompiled_function, "compiled-function");
3088 DEFSYM (Qbuffer, "buffer"); 3088 DEFSYM (Qbuffer, "buffer");
3089 DEFSYM (Qframe, "frame"); 3089 DEFSYM (Qframe, "frame");
@@ -3091,6 +3091,9 @@ syms_of_data (void)
3091 DEFSYM (Qchar_table, "char-table"); 3091 DEFSYM (Qchar_table, "char-table");
3092 DEFSYM (Qbool_vector, "bool-vector"); 3092 DEFSYM (Qbool_vector, "bool-vector");
3093 DEFSYM (Qhash_table, "hash-table"); 3093 DEFSYM (Qhash_table, "hash-table");
3094 /* Used by Fgarbage_collect. */
3095 DEFSYM (Qinterval, "interval");
3096 DEFSYM (Qmisc, "misc");
3094 3097
3095 DEFSYM (Qdefun, "defun"); 3098 DEFSYM (Qdefun, "defun");
3096 3099
@@ -3195,7 +3198,7 @@ syms_of_data (void)
3195 defsubr (&Ssubr_arity); 3198 defsubr (&Ssubr_arity);
3196 defsubr (&Ssubr_name); 3199 defsubr (&Ssubr_name);
3197 3200
3198 XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; 3201 set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
3199 3202
3200 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, 3203 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
3201 doc: /* The largest value that is representable in a Lisp integer. */); 3204 doc: /* The largest value that is representable in a Lisp integer. */);