From d021ddb220345dd93b251dc6ba50caf116c590c5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 27 May 2018 08:18:46 -0700 Subject: bugfix: fatal exception on missing .txr_history. The new abstraction layer used by linenoise throws exceptions, but linenoise excpects a null pointer when a file open fails. * parser.c (lino_open, lino_open8): Catch error exceptions and convert to null return, using new macros to reduce repetitive coding. * unwind.h (ignerr_begin, ignerr_end): New macros. --- unwind.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'unwind.h') diff --git a/unwind.h b/unwind.h index 0a7d20d3..b08f8dc9 100644 --- a/unwind.h +++ b/unwind.h @@ -288,3 +288,12 @@ noreturn val type_mismatch(val, ...); uw_unwind { } \ uw_catch_end; \ return _r_e_t; + +#define ignerr_begin \ + uw_catch_begin (cons(error_s, nil), _x_s_y_m, _x_a_r_g_s) + +#define ignerr_end \ + uw_catch(_x_s_y_m, _x_a_r_g_s) \ + (void) _x_s_y_m; (void) _x_a_r_g_s; \ + uw_unwind { } \ + uw_catch_end -- cgit v1.2.3