diff options
author | Philipp Stephani <phst@google.com> | 2019-04-19 18:38:19 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2019-04-19 18:41:15 +0200 |
commit | 8aadf6e415b7801cb9fa4c5670b1750da207cf87 (patch) | |
tree | be5b2ff82b5ffa0ef44684a76a9ad1676f13d3ed /src/eval.c | |
parent | bd93bcb078f29e9b5fa127d6cef0bdeeab5c2285 (diff) | |
download | emacs-8aadf6e415b7801cb9fa4c5670b1750da207cf87.tar.gz |
Refactoring: simplify definition of some internal variables.
In some cases, we never specbind internal objects, so they don't have
to be symbols. Rather than using DEFSYM/DEFVAR and then uninterning
the symbols, use plain static variables. Call staticpro for all of
them, to protect them from the garbage collector.
* src/eval.c (syms_of_eval): Use a static variable for
Qcatch_all_memory_full.
* src/emacs-module.c (syms_of_module): Use static variables for
Vmodule_refs_hash, Vmodule_runtimes, and Vmodule_environments.
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 23fd0efd54a..a2b95172d87 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1429,6 +1429,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), } } +static Lisp_Object Qcatch_all_memory_full; + /* Like a combination of internal_condition_case_1 and internal_catch. Catches all signals and throws. Never exits nonlocally; returns Qcatch_all_memory_full if no handler could be allocated. */ @@ -4188,8 +4190,12 @@ alist of active lexical bindings. */); staticpro (&Vsignaling_function); Vsignaling_function = Qnil; - DEFSYM (Qcatch_all_memory_full, "catch-all-memory-full"); - Funintern (Qcatch_all_memory_full, Qnil); + staticpro (&Qcatch_all_memory_full); + /* Make sure Qcatch_all_memory_full is a unique object. We could + also use something like Fcons (Qnil, Qnil), but json.c treats any + cons cell as error data, so use an uninterned symbol instead. */ + Qcatch_all_memory_full + = Fmake_symbol (build_pure_c_string ("catch-all-memory-full")); defsubr (&Sor); defsubr (&Sand); |