diff options
| author | Philipp Stephani | 2019-04-19 18:38:19 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2019-04-19 18:41:15 +0200 |
| commit | 8aadf6e415b7801cb9fa4c5670b1750da207cf87 (patch) | |
| tree | be5b2ff82b5ffa0ef44684a76a9ad1676f13d3ed /src/eval.c | |
| parent | bd93bcb078f29e9b5fa127d6cef0bdeeab5c2285 (diff) | |
| download | emacs-8aadf6e415b7801cb9fa4c5670b1750da207cf87.tar.gz emacs-8aadf6e415b7801cb9fa4c5670b1750da207cf87.zip | |
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 *), | |||
| 1429 | } | 1429 | } |
| 1430 | } | 1430 | } |
| 1431 | 1431 | ||
| 1432 | static Lisp_Object Qcatch_all_memory_full; | ||
| 1433 | |||
| 1432 | /* Like a combination of internal_condition_case_1 and internal_catch. | 1434 | /* Like a combination of internal_condition_case_1 and internal_catch. |
| 1433 | Catches all signals and throws. Never exits nonlocally; returns | 1435 | Catches all signals and throws. Never exits nonlocally; returns |
| 1434 | Qcatch_all_memory_full if no handler could be allocated. */ | 1436 | Qcatch_all_memory_full if no handler could be allocated. */ |
| @@ -4188,8 +4190,12 @@ alist of active lexical bindings. */); | |||
| 4188 | staticpro (&Vsignaling_function); | 4190 | staticpro (&Vsignaling_function); |
| 4189 | Vsignaling_function = Qnil; | 4191 | Vsignaling_function = Qnil; |
| 4190 | 4192 | ||
| 4191 | DEFSYM (Qcatch_all_memory_full, "catch-all-memory-full"); | 4193 | staticpro (&Qcatch_all_memory_full); |
| 4192 | Funintern (Qcatch_all_memory_full, Qnil); | 4194 | /* Make sure Qcatch_all_memory_full is a unique object. We could |
| 4195 | also use something like Fcons (Qnil, Qnil), but json.c treats any | ||
| 4196 | cons cell as error data, so use an uninterned symbol instead. */ | ||
| 4197 | Qcatch_all_memory_full | ||
| 4198 | = Fmake_symbol (build_pure_c_string ("catch-all-memory-full")); | ||
| 4193 | 4199 | ||
| 4194 | defsubr (&Sor); | 4200 | defsubr (&Sor); |
| 4195 | defsubr (&Sand); | 4201 | defsubr (&Sand); |