diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-08-04 20:52:10 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-08-04 20:52:10 -0700 |
commit | 29b5a31ad6d3783e9bb178f35d21110bea06451e (patch) | |
tree | 4a19b7113c79b0d80e93c7501db45aac9fe9c1f8 /tests/010 | |
parent | 75c6845ef1fc840afe995a84f3cd1c94f5257d7d (diff) | |
download | txr-29b5a31ad6d3783e9bb178f35d21110bea06451e.tar.gz txr-29b5a31ad6d3783e9bb178f35d21110bea06451e.tar.bz2 txr-29b5a31ad6d3783e9bb178f35d21110bea06451e.zip |
close-stream: make idemponent.
* stream.c (strm_base_init): Add new element to the initializer to
initialize the close_result member to nao, indicating that the close
operation has not been invoked.
(strm_base_mark): Mark the close_result value, if it isn't nao.
This is just in case it is a heap object. The structure delegate
mechanism opens the possibility that the stream is actually user code
that can return anything so we have to be careful.
(close_stream): Only call ops->close if close_result is nao, indicating
that close had never been called (or possibly that it had been called
bu threw an exception) and store the return value in close_result,
otherwise return the previously stored value.
* stream.h (struct strm_base): New member, close_result.
* txr.1: Documented.
Diffstat (limited to 'tests/010')
0 files changed, 0 insertions, 0 deletions