diff options
author | Philipp Stephani <phst@google.com> | 2019-04-19 01:04:55 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2019-04-19 01:04:55 +0200 |
commit | 23a82cba12380b0905670c34395dc460a4bc9984 (patch) | |
tree | df001ea84a8173dab9381a3ec75d36d25f6a3650 /src/json.c | |
parent | e712a8fe0929a18eaf3f4ec83b023f475afdc4d4 (diff) | |
download | emacs-23a82cba12380b0905670c34395dc460a4bc9984.tar.gz |
Refactoring: have CATCHER_ALL also catch signals.
In all cases where we use a CATCHER_ALL handler we also want to catch
signals. Therefore have 'signal' respect CATCHER_ALL. Adapt internal
interfaces so that handlers can distinguish among the two types of
nonlocal exits in CATCHER_ALL handlers.
* src/lisp.h (enum nonlocal_exit): New enum.
(struct handler): Add member 'nonlocal_exit' to hold the type of
nonlocal exit during stack unwinding.
* src/eval.c (signal_or_quit): Also respect CATCHER_ALL handlers.
(unwind_to_catch): Store nonlocal exit type in catch structure.
(Fthrow, signal_or_quit): Adapt callers.
(internal_catch_all): Install only one handler. Give handler a
nonlocal exit type argument.
(internal_catch_all_1): Remove, no longer needed.
* src/emacs-module.c (MODULE_SETJMP): Install only one handler.
(module_handle_nonlocal_exit): New function to handle all nonlocal
exits.
(MODULE_SETJMP_1): Pass nonlocal exit type to handler function.
(module_handle_signal, module_handle_throw): Remove, no longer needed.
* src/json.c (json_handle_nonlocal_exit): New helper function.
(json_insert_callback): Adapt to change in 'internal_catch_all'.
Diffstat (limited to 'src/json.c')
-rw-r--r-- | src/json.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c index 5917212899e..014ac3e3168 100644 --- a/src/json.c +++ b/src/json.c @@ -665,6 +665,18 @@ json_insert (void *data) return Qnil; } +static Lisp_Object +json_handle_nonlocal_exit (enum nonlocal_exit type, Lisp_Object data) +{ + switch (type) + { + case NONLOCAL_EXIT_SIGNAL: + return data; + case NONLOCAL_EXIT_THROW: + return Fcons (Qno_catch, data); + } +} + struct json_insert_data { /* This tracks how many bytes were inserted by the callback since @@ -687,7 +699,8 @@ json_insert_callback (const char *buffer, size_t size, void *data) struct json_insert_data *d = data; struct json_buffer_and_size buffer_and_size = {.buffer = buffer, .size = size, .inserted_bytes = d->inserted_bytes}; - d->error = internal_catch_all (json_insert, &buffer_and_size, Fidentity); + d->error = internal_catch_all (json_insert, &buffer_and_size, + json_handle_nonlocal_exit); d->inserted_bytes = buffer_and_size.inserted_bytes; return NILP (d->error) ? 0 : -1; } |