diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-09-07 07:14:02 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-09-07 07:14:02 -0700 |
commit | 98ed59198be3104e82c00734e01f4a1022440d1b (patch) | |
tree | 1d6130cc914977b7897834407f6148cfc54cbec0 /eval.c | |
parent | 575851b07a498847b8ddeaf94db8bc177c4f57c1 (diff) | |
download | txr-98ed59198be3104e82c00734e01f4a1022440d1b.tar.gz txr-98ed59198be3104e82c00734e01f4a1022440d1b.tar.bz2 txr-98ed59198be3104e82c00734e01f4a1022440d1b.zip |
string-extend: third optional argument.
A Boolean optional argument to string-extend indicates whether
this is likely the last call to string-extend, so memory can
be trimmed accordingly.
* eval.c (eval_init): Update string-extend registration.
* filter.c (trie_filter_string): Pass nil for new argument of
string_extend.
* lib.c (str_seq, replace_str,
lazy_str_force, lazy_str_force_upto): Pass nil for new
argument of string_extend.
(rem_impl, remove_if, separate): Pass t for new argument of
string_extend on last iteration, nil otherwise.
(string_extend): Implement new third argument, defaulted to
nil. Switch from chk_grow_vec to the more specific chk_wrealloc,
which simplifies the code.
* lib.h (string_extend): Declaration updated.
* parser.y (litchars): Pass t as last argument of
string_extend since we know syntactically that these
reductions finalize the string.
(restlitchar): Pass nil as the last argument of string_extend,
since we know syntactically that it isn't the last.
* regex.c (scan_until_common): Pass nil for new argument of
string_extend.
* txr.1: Documented.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -7143,7 +7143,7 @@ void eval_init(void) reg_fun(intern(lit("copy-str"), user_package), func_n1(copy_str)); reg_fun(intern(lit("upcase-str"), user_package), func_n1(upcase_str)); reg_fun(intern(lit("downcase-str"), user_package), func_n1(downcase_str)); - reg_fun(intern(lit("string-extend"), user_package), func_n2(string_extend)); + reg_fun(intern(lit("string-extend"), user_package), func_n3o(string_extend, 2)); reg_fun(intern(lit("stringp"), user_package), func_n1(stringp)); reg_fun(intern(lit("lazy-stringp"), user_package), func_n1(lazy_stringp)); reg_fun(intern(lit("length-str"), user_package), func_n1(length_str)); |