aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorJoakim Verona2012-08-15 21:49:40 +0200
committerJoakim Verona2012-08-15 21:49:40 +0200
commitb648c26ec642a1dc58c0bd7e59d6011b964dbe37 (patch)
treef0f3b38ffa9054702f475fc53622e28da14f97b1 /src/data.c
parentc8b0fc1999006af5a4317b44068fac13d9592143 (diff)
parent94c9ece10275f8ca9323c38f93607f1046035c79 (diff)
downloademacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.tar.gz
emacs-b648c26ec642a1dc58c0bd7e59d6011b964dbe37.zip
upstream
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/data.c b/src/data.c
index 4c6f7fe3eae..d0ef5734abc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -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 (SVAR (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 SVAR (XSYMBOL (symbol), function) = Qunbound; 588 set_symbol_function (symbol, Qunbound);
589 return symbol; 589 return symbol;
590} 590}
591 591
@@ -594,8 +594,8 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
594 (register Lisp_Object symbol) 594 (register Lisp_Object symbol)
595{ 595{
596 CHECK_SYMBOL (symbol); 596 CHECK_SYMBOL (symbol);
597 if (!EQ (SVAR (XSYMBOL (symbol), function), Qunbound)) 597 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
598 return SVAR (XSYMBOL (symbol), function); 598 return XSYMBOL (symbol)->function;
599 xsignal1 (Qvoid_function, symbol); 599 xsignal1 (Qvoid_function, symbol);
600} 600}
601 601
@@ -604,7 +604,7 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
604 (register Lisp_Object symbol) 604 (register Lisp_Object symbol)
605{ 605{
606 CHECK_SYMBOL (symbol); 606 CHECK_SYMBOL (symbol);
607 return SVAR (XSYMBOL (symbol), plist); 607 return XSYMBOL (symbol)->plist;
608} 608}
609 609
610DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0, 610DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -628,7 +628,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
628 if (NILP (symbol) || EQ (symbol, Qt)) 628 if (NILP (symbol) || EQ (symbol, Qt))
629 xsignal1 (Qsetting_constant, symbol); 629 xsignal1 (Qsetting_constant, symbol);
630 630
631 function = SVAR (XSYMBOL (symbol), function); 631 function = XSYMBOL (symbol)->function;
632 632
633 if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) 633 if (!NILP (Vautoload_queue) && !EQ (function, Qunbound))
634 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); 634 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -636,13 +636,13 @@ 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 SVAR (XSYMBOL (symbol), function) = definition; 639 set_symbol_function (symbol, definition);
640 /* Handle automatic advice activation. */ 640 /* Handle automatic advice activation. */
641 if (CONSP (SVAR (XSYMBOL (symbol), plist)) 641 if (CONSP (XSYMBOL (symbol)->plist)
642 && !NILP (Fget (symbol, Qad_advice_info))) 642 && !NILP (Fget (symbol, Qad_advice_info)))
643 { 643 {
644 call2 (Qad_activate_internal, symbol, Qnil); 644 call2 (Qad_activate_internal, symbol, Qnil);
645 definition = SVAR (XSYMBOL (symbol), function); 645 definition = XSYMBOL (symbol)->function;
646 } 646 }
647 return definition; 647 return definition;
648} 648}
@@ -657,8 +657,8 @@ The return value is undefined. */)
657 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) 657 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
658{ 658{
659 CHECK_SYMBOL (symbol); 659 CHECK_SYMBOL (symbol);
660 if (CONSP (SVAR (XSYMBOL (symbol), function)) 660 if (CONSP (XSYMBOL (symbol)->function)
661 && EQ (XCAR (SVAR (XSYMBOL (symbol), function)), Qautoload)) 661 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
662 LOADHIST_ATTACH (Fcons (Qt, symbol)); 662 LOADHIST_ATTACH (Fcons (Qt, symbol));
663 if (!NILP (Vpurify_flag) 663 if (!NILP (Vpurify_flag)
664 /* If `definition' is a keymap, immutable (and copying) is wrong. */ 664 /* If `definition' is a keymap, immutable (and copying) is wrong. */
@@ -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 SVAR (XSYMBOL (symbol), plist) = newplist; 682 set_symbol_plist (symbol, newplist);
683 return newplist; 683 return newplist;
684} 684}
685 685
@@ -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))
@@ -1006,7 +1008,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1006 XSETSYMBOL (var, symbol); 1008 XSETSYMBOL (var, symbol);
1007 if (blv->frame_local) 1009 if (blv->frame_local)
1008 { 1010 {
1009 tem1 = assq_no_quit (var, FVAR (XFRAME (selected_frame), param_alist)); 1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1010 blv->where = selected_frame; 1012 blv->where = selected_frame;
1011 } 1013 }
1012 else 1014 else
@@ -1179,7 +1181,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1179 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
1180 tem1 = Fassq (symbol, 1182 tem1 = Fassq (symbol,
1181 (blv->frame_local 1183 (blv->frame_local
1182 ? FVAR (XFRAME (where), param_alist) 1184 ? XFRAME (where)->param_alist
1183 : BVAR (XBUFFER (where), local_var_alist))); 1185 : BVAR (XBUFFER (where), local_var_alist)));
1184 blv->where = where; 1186 blv->where = where;
1185 blv->found = 1; 1187 blv->found = 1;
@@ -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
@@ -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
@@ -2019,12 +2021,12 @@ indirect_function (register Lisp_Object object)
2019 { 2021 {
2020 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2022 if (!SYMBOLP (hare) || EQ (hare, Qunbound))
2021 break; 2023 break;
2022 hare = SVAR (XSYMBOL (hare), function); 2024 hare = XSYMBOL (hare)->function;
2023 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2025 if (!SYMBOLP (hare) || EQ (hare, Qunbound))
2024 break; 2026 break;
2025 hare = SVAR (XSYMBOL (hare), function); 2027 hare = XSYMBOL (hare)->function;
2026 2028
2027 tortoise = SVAR (XSYMBOL (tortoise), function); 2029 tortoise = XSYMBOL (tortoise)->function;
2028 2030
2029 if (EQ (hare, tortoise)) 2031 if (EQ (hare, tortoise))
2030 xsignal1 (Qcyclic_function_indirection, object); 2032 xsignal1 (Qcyclic_function_indirection, object);
@@ -2048,7 +2050,7 @@ function chain of symbols. */)
2048 /* Optimize for no indirection. */ 2050 /* Optimize for no indirection. */
2049 result = object; 2051 result = object;
2050 if (SYMBOLP (result) && !EQ (result, Qunbound) 2052 if (SYMBOLP (result) && !EQ (result, Qunbound)
2051 && (result = SVAR (XSYMBOL (result), function), SYMBOLP (result))) 2053 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
2052 result = indirect_function (result); 2054 result = indirect_function (result);
2053 if (!EQ (result, Qunbound)) 2055 if (!EQ (result, Qunbound))
2054 return result; 2056 return result;
@@ -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);
@@ -3197,7 +3198,7 @@ syms_of_data (void)
3197 defsubr (&Ssubr_arity); 3198 defsubr (&Ssubr_arity);
3198 defsubr (&Ssubr_name); 3199 defsubr (&Ssubr_name);
3199 3200
3200 SVAR (XSYMBOL (Qwholenump), function) = SVAR (XSYMBOL (Qnatnump), function); 3201 set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
3201 3202
3202 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum, 3203 DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
3203 doc: /* The largest value that is representable in a Lisp integer. */); 3204 doc: /* The largest value that is representable in a Lisp integer. */);