diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-05-30 09:08:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-05-30 09:08:50 -0700 |
commit | 1f54ad5cc1d384d0818a6bf6cec20a95ecc5a5ae (patch) | |
tree | aab51e24a075aed919f5ed3ad4d8232130768730 /parser.c | |
parent | c5134a9ddba4fd14703d506b0cccd51d823e013e (diff) | |
download | txr-1f54ad5cc1d384d0818a6bf6cec20a95ecc5a5ae.tar.gz txr-1f54ad5cc1d384d0818a6bf6cec20a95ecc5a5ae.tar.bz2 txr-1f54ad5cc1d384d0818a6bf6cec20a95ecc5a5ae.zip |
Replace trivial format(nil, ...) with simpler ops.
* gencadr.txr (cadr_register): Use scat2 to glue two strings.
* cadr.c: Regenerated.
* lib.c (scat2, scat3): New functions.
* lib.h (scat2, scat3): Declared.
* liblib.c (place_instantiate, ver_instantiate,
ifa_instantiate, txr_case_instantiate,
with_resources_instantiate, path_test_instantiate,
struct_instantiate, with_stream_instantiate, hash_instantiate,
except_instantiate, type_instantiate, yield_instantiate,
sock_instantiate, termios_instantiate, awk_instantiate,
build_instantiate, trace_instantiate, getopts_instantiate,
package_instantiate, getput_instantiate, tagbody_instantiate,
pmac_instantiate, error_instantiate, keyparams_instantiate,
ffi_instantiate, doloop_instantiate, stream_wrap_instantiate,
asm_instantiate, compiler_instantiate, debugger_instantiate,
op_instantiate, save_exe_instantiate, defset_instantiate,
copy_file_instantiate): Use scat2 to glue two strings instead
of format.
* parser.c (find_matching_syms, hist_save, repl): Replace
trivial uses of format with scat2 or scat3.
* sysif.c (ensure_dir): Likewise.
* txr.c (get_self_path, substitute_basename, sysroot,
sysroot_init, parse_once_noerr, read_compiled_file_noerr,
read_eval_stream_noerr): Likewise.
* unwind.c (uw_unwind_to_exit_point): Likewise.
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -966,9 +966,9 @@ static void find_matching_syms(lino_completions_t *cpl, continue; if (qualify) - comple = format(nil, lit("~a~a:~a"), line_prefix, pkg_name, name, nao); + comple = scat(line_prefix, pkg_name, lit(":"), name, nao); else - comple = format(nil, lit("~a~a"), line_prefix, name, nao); + comple = scat2(line_prefix, name); lino_add_completion(cpl, c_str(comple)); gc_hint(comple); @@ -1406,7 +1406,7 @@ static void hist_save(lino_t *ls, val in_stream, val out_stream, val hist_len_var) { if (histfile_w && lino_have_new_lines(ls)) { - val histfile_tmp = format(nil, lit("~a.tmp"), histfile, nao); + val histfile_tmp = scat2(histfile, lit(".tmp")); const wchar_t *histfile_tmp_w = c_str(histfile_tmp); lino_t *ltmp = lino_make(coerce(mem_t *, in_stream), coerce(mem_t *, out_stream)); @@ -1442,9 +1442,9 @@ val repl(val bindings, val in_stream, val out_stream, val env) val done = nil; val counter = one; val home = if3(repl_level == 1, get_home_path(), nil); - val histfile = if2(home, format(nil, lit("~a/.txr_history"), home, nao)); + val histfile = if2(home, scat2(home, lit("/.txr_history"))); const wchar_t *histfile_w = if3(home, c_str(histfile), NULL); - val rcfile = if2(home, format(nil, lit("~a/.txr_profile"), home, nao)); + val rcfile = if2(home, scat2(home, lit("/.txr_profile"))); val old_sig_handler = set_sig_handler(num(SIGINT), func_n2(repl_intr)); val hist_len_var = lookup_global_var(listener_hist_len_s); val multi_line_var = lookup_global_var(listener_multi_line_p_s); |