summaryrefslogtreecommitdiffstats
path: root/itypes.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-01 22:17:16 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-01 22:17:16 -0700
commitdd3ff4c38db7c9daa72d5074c986a1462ab3bb8e (patch)
treeb06ac035086f1412f799482d5e9fb23e9393afe3 /itypes.h
parent0e72e53ef4693e022dbb83b87924ae7470e42e8f (diff)
downloadtxr-dd3ff4c38db7c9daa72d5074c986a1462ab3bb8e.tar.gz
txr-dd3ff4c38db7c9daa72d5074c986a1462ab3bb8e.tar.bz2
txr-dd3ff4c38db7c9daa72d5074c986a1462ab3bb8e.zip
streams: tightening sloppy argument defaulting.
Numerous functions in TXR Lisp treat a nil argument for an optional parameter as if it were omitted. In the case of streams, this can cause problems. An accidental nil passed to an input function can cause it to read from standard input and hang. In this patch, argument defaulting is tighented for functions that perform I/O. It's mostly stream parameters, but not exclusively. * eval.c (prinl, pprinl): Use default_arg_strict to default the stream argument, and also re-use that value for the put_char call. * lib.c (lazy_stream_cons, print, pprint, put_json): Use default_arg_strict rather than default_arg. * parser.c (regex_parse, lisp_parse_impl, txr_parse): Tighten the defaulting of the input stream and error stream arguments, streamlining the logic at the same time. * stream.c (do_parse_mode): Use default_arg_strict for the mode string argument. (record_adapter, get_line, get_char, get_byte, get_bytes, unget_byte, put_buf, fill_buf, fill_buf_adjust, get_line_as_buf, put_string, put_char, put_byte, put_line, flush_stream, get_string): Use strict defaulting for stream argument. (mkstemp_wrap): Use strict defaulting for suffix.
Diffstat (limited to 'itypes.h')
0 files changed, 0 insertions, 0 deletions