From ceac568650dfe4234d3da21fa75bedeaf76dfbdd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 29 Aug 2022 22:48:13 -0700 Subject: txr: close streams. * match.c (noclose_k): New keyword variable. (v_next_keys, v_output_keys): New static variables. (v_next_impl): Use v_next_keys in calculating alist, rather than freshly allocating it each time. Check for the new :noclose keyword; if it is missing, close any locally opened stream when done. (v_output): Refer to v_output_keys precalculated list rather than allocating it every time. (match_files): If a stream is opened in by a call to open_data_source from this function, then the stream is closed when this function returns. (syms_init): Intern the :noclose symbol. (plist_keys_init): New function. (match_init): Call plist_keys_init. * txr.1: Documented new :noclose option of @(next). --- match.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'match.h') diff --git a/match.h b/match.h index b697cc0a..47b6070c 100644 --- a/match.h +++ b/match.h @@ -29,7 +29,7 @@ extern val text_s, choose_s, gather_s, do_s, mdo_s, require_s, in_package_s; extern val close_s, load_s, include_s, mod_s, modlast_s, line_s; extern val else_s, elif_s; -extern val counter_k, vars_k, lists_k, env_k, var_k, into_k, named_k; +extern val counter_k, vars_k, lists_k, env_k, var_k, into_k, named_k, noclose_k; val match_expand_keyword_args(val elem); val match_expand_elem(val elem); val match_filter(val name, val arg, val other_args); -- cgit v1.2.3