diff options
| author | Philipp Stephani | 2017-06-04 19:02:50 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-06-04 19:50:50 +0200 |
| commit | 045d21c20a60e2c336568516d620d6f98ca3642d (patch) | |
| tree | dd129cf5eb43d7b776adcee17eaa62cd205def79 /src | |
| parent | 3b0080de52db1756fc47f1642ee9980655421af9 (diff) | |
| download | emacs-045d21c20a60e2c336568516d620d6f98ca3642d.tar.gz emacs-045d21c20a60e2c336568516d620d6f98ca3642d.zip | |
Rationalize environment lifetime management functions
* src/emacs-module.c (Fmodule_load, funcall_module): Adapt callers.
(finalize_environment): Add parameter for public part of the
environment, like 'initialize_environment'. Add assertions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index f9e76b5f0f8..0fb126e61f5 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -100,8 +100,8 @@ static Lisp_Object value_to_lisp (emacs_value); | |||
| 100 | static emacs_value lisp_to_value (Lisp_Object); | 100 | static emacs_value lisp_to_value (Lisp_Object); |
| 101 | static enum emacs_funcall_exit module_non_local_exit_check (emacs_env *); | 101 | static enum emacs_funcall_exit module_non_local_exit_check (emacs_env *); |
| 102 | static void check_main_thread (void); | 102 | static void check_main_thread (void); |
| 103 | static void finalize_environment (struct emacs_env_private *); | 103 | static void initialize_environment (emacs_env *, struct emacs_env_private *); |
| 104 | static void initialize_environment (emacs_env *, struct emacs_env_private *priv); | 104 | static void finalize_environment (emacs_env *, struct emacs_env_private *); |
| 105 | static void module_handle_signal (emacs_env *, Lisp_Object); | 105 | static void module_handle_signal (emacs_env *, Lisp_Object); |
| 106 | static void module_handle_throw (emacs_env *, Lisp_Object); | 106 | static void module_handle_throw (emacs_env *, Lisp_Object); |
| 107 | static void module_non_local_exit_signal_1 (emacs_env *, Lisp_Object, Lisp_Object); | 107 | static void module_non_local_exit_signal_1 (emacs_env *, Lisp_Object, Lisp_Object); |
| @@ -632,7 +632,7 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0, | |||
| 632 | .get_environment = module_get_environment | 632 | .get_environment = module_get_environment |
| 633 | }; | 633 | }; |
| 634 | int r = module_init (&pub); | 634 | int r = module_init (&pub); |
| 635 | finalize_environment (&priv); | 635 | finalize_environment (&rt.pub, &priv); |
| 636 | 636 | ||
| 637 | if (r != 0) | 637 | if (r != 0) |
| 638 | { | 638 | { |
| @@ -676,20 +676,20 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, Lisp_Object *arglist) | |||
| 676 | switch (priv.pending_non_local_exit) | 676 | switch (priv.pending_non_local_exit) |
| 677 | { | 677 | { |
| 678 | case emacs_funcall_exit_return: | 678 | case emacs_funcall_exit_return: |
| 679 | finalize_environment (&priv); | 679 | finalize_environment (&pub, &priv); |
| 680 | return value_to_lisp (ret); | 680 | return value_to_lisp (ret); |
| 681 | case emacs_funcall_exit_signal: | 681 | case emacs_funcall_exit_signal: |
| 682 | { | 682 | { |
| 683 | Lisp_Object symbol = priv.non_local_exit_symbol; | 683 | Lisp_Object symbol = priv.non_local_exit_symbol; |
| 684 | Lisp_Object data = priv.non_local_exit_data; | 684 | Lisp_Object data = priv.non_local_exit_data; |
| 685 | finalize_environment (&priv); | 685 | finalize_environment (&pub, &priv); |
| 686 | xsignal (symbol, data); | 686 | xsignal (symbol, data); |
| 687 | } | 687 | } |
| 688 | case emacs_funcall_exit_throw: | 688 | case emacs_funcall_exit_throw: |
| 689 | { | 689 | { |
| 690 | Lisp_Object tag = priv.non_local_exit_symbol; | 690 | Lisp_Object tag = priv.non_local_exit_symbol; |
| 691 | Lisp_Object value = priv.non_local_exit_data; | 691 | Lisp_Object value = priv.non_local_exit_data; |
| 692 | finalize_environment (&priv); | 692 | finalize_environment (&pub, &priv); |
| 693 | Fthrow (tag, value); | 693 | Fthrow (tag, value); |
| 694 | } | 694 | } |
| 695 | default: | 695 | default: |
| @@ -904,7 +904,7 @@ initialize_environment (emacs_env *env, struct emacs_env_private *priv) | |||
| 904 | /* Must be called before the lifetime of the environment object | 904 | /* Must be called before the lifetime of the environment object |
| 905 | ends. */ | 905 | ends. */ |
| 906 | static void | 906 | static void |
| 907 | finalize_environment (struct emacs_env_private *env) | 907 | finalize_environment (emacs_env *env, struct emacs_env_private *priv) |
| 908 | { | 908 | { |
| 909 | Vmodule_environments = XCDR (Vmodule_environments); | 909 | Vmodule_environments = XCDR (Vmodule_environments); |
| 910 | } | 910 | } |