ports: avoid adding port table entries and finalizers if possible
authorAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 13:01:52 +0000 (14:01 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 14 Feb 2012 13:10:53 +0000 (14:10 +0100)
commit03a2eeb0cc032f48f8b789a04a41f37a6459d879
treedbba31f2ce93bcc3071f30a964c92e7bc9fe50d8
parent6c98257f2ead0855f218369ea7f9a823cdb9727e
ports: avoid adding port table entries and finalizers if possible

* libguile/ports.h (scm_t_port_type_flags, scm_t_ptob_descriptor): Add
  flags to ptob descriptors.

* libguile/ports.c (scm_set_port_flush): Set the SCM_PORT_TYPE_HAS_FLUSH
  flag here.
  (scm_c_make_port_with_encoding): Only add ports to the table if
  SCM_PORT_TYPE_HAS_FLUSH is set.  Only add finalizers to ports if there
  is a free function.
  (scm_close_port): Inline scm_i_remove_port here.  Only remove from the
  weak set if SCM_PORT_TYPE_HAS_FLUSH is set.
  (scm_set_port_revealed_x): Add a comment.
libguile/ports.c
libguile/ports.h