summaryrefslogtreecommitdiff
path: root/libguile/fports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-04-03 11:39:21 +0200
committerAndy Wingo <wingo@pobox.com>2016-04-04 16:30:56 +0200
commit67b147fb7a5e8771b0314fcc0fcc826db09d9949 (patch)
tree16fb15deb0f53abbd4dfc8e511a4443aba775a66 /libguile/fports.c
parent4460f1f15280e3378633115fe9035448a68c636b (diff)
downloadguile-67b147fb7a5e8771b0314fcc0fcc826db09d9949.tar.gz
Remove port free functions; just close instead
* libguile/ports.h (scm_t_port_type_flags): Replace SCM_PORT_TYPE_HAS_FLUSH with SCM_PORT_TYPE_NEEDS_CLOSE_ON_GC. (scm_t_ptob_descriptor): Remove free function. * libguile/ports.c (scm_set_port_needs_close_on_gc): New function. (scm_set_port_flush): Don't set flags. (scm_c_make_port_with_encoding, scm_close_port): Use the new flag to determine when to add a finalizer and also when to include the port in the weak set. (scm_set_port_free): Remove. (do_close, finalize_port): Close port instead of calling free function. * libguile/r6rs-ports.c (initialize_transcoded_ports): * libguile/vports.c (scm_make_sfptob): * libguile/fports.c (scm_make_fptob): Mark these ports as needing close on GC. * libguile/fports.c (fport_free): Remove. * NEWS: Update. * doc/ref/api-io.texi (Port Implementation): Update.
Diffstat (limited to 'libguile/fports.c')
-rw-r--r--libguile/fports.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/libguile/fports.c b/libguile/fports.c
index 8ad8ba0ca..3f4c8cc2e 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -858,19 +858,12 @@ fport_close (SCM port)
return 0;
}
-static size_t
-fport_free (SCM port)
-{
- fport_close (port);
- return 0;
-}
-
static scm_t_bits
scm_make_fptob ()
{
scm_t_bits tc = scm_make_port_type ("file", fport_fill_input, fport_write);
- scm_set_port_free (tc, fport_free);
+ scm_set_port_needs_close_on_gc (tc, 1);
scm_set_port_print (tc, fport_print);
scm_set_port_flush (tc, fport_flush);
scm_set_port_end_input (tc, fport_end_input);