diff options
author | Andy Wingo <wingo@pobox.com> | 2011-10-23 20:51:52 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-10-23 20:52:29 +0200 |
commit | 2721f9182da74cf98426cc335f3f39c265cc412d (patch) | |
tree | df24895aaa6fabcc4103d263e40f540f24c141ff /libguile/ioext.c | |
parent | 7887be7df59b6f909aa9008454354f45dac1a8ea (diff) | |
download | guile-2721f9182da74cf98426cc335f3f39c265cc412d.tar.gz |
add scm_c_make_port; the port table is now a weak set
* libguile/ports.c (scm_c_make_port_with_encoding, scm_c_make_port): New
functions, to replace scm_new_port_table_entry. Use a weak set
instead of a weak table.
(scm_i_remove_port):
(scm_c_port_for_each, scm_port_for_each): Adapt to use weak set.
(scm_i_void_port): Use scm_c_make_port.
(scm_init_ports): Make a weak set.
* libguile/fports.c:
* libguile/ioext.c:
* libguile/r6rs-ports.c:
* libguile/strports.c:
* libguile/vports.c: Adapt to use the new scm_c_make_port API.
Diffstat (limited to 'libguile/ioext.c')
-rw-r--r-- | libguile/ioext.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libguile/ioext.c b/libguile/ioext.c index 6b0c9b88c..cb55fb2c3 100644 --- a/libguile/ioext.c +++ b/libguile/ioext.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2006, 2011 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 @@ -269,7 +269,7 @@ SCM_DEFINE (scm_primitive_move_to_fdes, "primitive-move->fdes", 2, 0, 0, #undef FUNC_NAME static SCM -get_matching_port (void *closure, SCM port, SCM val, SCM result) +get_matching_port (void *closure, SCM port, SCM result) { int fd = * (int *) closure; scm_t_port *entry = SCM_PTAB_ENTRY (port); @@ -292,11 +292,9 @@ SCM_DEFINE (scm_fdes_to_ports, "fdes->ports", 1, 0, 0, SCM result = SCM_EOL; int int_fd = scm_to_int (fd); - scm_i_scm_pthread_mutex_lock (&scm_i_port_table_mutex); - result = scm_internal_hash_fold (get_matching_port, - (void*) &int_fd, result, - scm_i_port_weak_hash); - scm_i_pthread_mutex_unlock (&scm_i_port_table_mutex); + result = scm_c_weak_set_fold (get_matching_port, + (void*) &int_fd, result, + scm_i_port_weak_set); return result; } #undef FUNC_NAME |