summaryrefslogtreecommitdiff
path: root/libguile/fports.h
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-12 12:04:34 +0200
committerLudovic Courtès <ludo@gnu.org>2017-10-25 11:39:38 -0700
commit1008ea315483d1fb41b2a8c10680e511238836d0 (patch)
treeed5099f0818e2f810231eceb4a66e626f2332de6 /libguile/fports.h
parentbf060d2affbfea8e7b69d160b8214d791661f236 (diff)
downloadguile-1008ea315483d1fb41b2a8c10680e511238836d0.tar.gz
Allow garbage collection of revealed file ports.
Reported at <https://bugs.gnu.org/28784>. Discussed at <https://lists.gnu.org/archive/html/guile-devel/2017-10/msg00003.html>. * libguile/fports.c (revealed_ports, revealed_lock): Remove. (scm_revealed_count): Just return 'SCM_REVEALED (port)'. (scm_set_port_revealed_x, scm_adjust_port_revealed_x): Remove REVEALED_PORTS manipulation. (fport_close): Do nothing when SCM_REVEALED (port) > 0. * libguile/fports.h (scm_t_fport): Adjust comment; make 'revealed' unsigned. * libguile/ports.c (do_close): Call 'close_port' instead of 'scm_close_port'. (scm_close_port): Rename to... (close_port): ... this. Add 'explicit' parameter. Clear 'revealed' field when PORT is a file port and EXPLICIT is true. (scm_close_port): Call 'close_port'. * test-suite/tests/ports.test ("close-port & revealed port") ("revealed port fdes not closed"): New tests.
Diffstat (limited to 'libguile/fports.h')
-rw-r--r--libguile/fports.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/libguile/fports.h b/libguile/fports.h
index afb8ba771..e397fcc59 100644
--- a/libguile/fports.h
+++ b/libguile/fports.h
@@ -3,7 +3,8 @@
#ifndef SCM_FPORTS_H
#define SCM_FPORTS_H
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2001, 2006, 2008, 2009, 2011, 2012,
+ * 2017 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -33,9 +34,8 @@
typedef struct scm_t_fport {
/* The file descriptor. */
int fdes;
- /* Revealed count; 0 indicates not revealed, > 1 revealed. Revealed
- ports do not get garbage-collected. */
- int revealed;
+ /* Revealed count; 0 indicates not revealed, > 1 revealed. */
+ unsigned int revealed;
/* Set of scm_fport_option flags. */
unsigned options;
} scm_t_fport;