lua/executor.c: use TRY_WRAP

This commit is contained in:
Justin M. Keyes
2019-10-27 15:26:32 -07:00
parent 83b6d9f197
commit efaf4732e2
3 changed files with 17 additions and 21 deletions

View File

@@ -102,6 +102,20 @@ typedef struct {
int did_emsg;
} TryState;
// `msg_list` controls the collection of abort-causing non-exception errors,
// which would otherwise be ignored. This pattern is from do_cmdline().
//
// TODO(bfredl): prepare error-handling at "top level" (nv_event).
#define TRY_WRAP(code) \
do { \
struct msglist **saved_msg_list = msg_list; \
struct msglist *private_msg_list; \
msg_list = &private_msg_list; \
private_msg_list = NULL; \
code \
msg_list = saved_msg_list; /* Restore the exception context. */ \
} while (0)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/helpers.h.generated.h"
#endif

View File

@@ -53,20 +53,6 @@
# include "api/vim.c.generated.h"
#endif
// `msg_list` controls the collection of abort-causing non-exception errors,
// which would otherwise be ignored. This pattern is from do_cmdline().
//
// TODO(bfredl): prepare error-handling at "top level" (nv_event).
#define TRY_WRAP(code) \
do { \
struct msglist **saved_msg_list = msg_list; \
struct msglist *private_msg_list; \
msg_list = &private_msg_list; \
private_msg_list = NULL; \
code \
msg_list = saved_msg_list; /* Restore the exception context. */ \
} while (0)
void api_vim_init(void)
FUNC_API_NOEXPORT
{