summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes <ludovic.courtes@laas.fr>2006-04-02 21:05:34 +0000
committerLudovic Courtès <ludo@gnu.org>2008-09-05 00:46:22 +0200
commit6a4be32986a1af4aa6cab917b3b62f90b3436476 (patch)
tree6eb45fa7adb6ac53ac99d8d70474d266a85ba878
parentfca4388748645f817e69505cb2c2c7733debb99b (diff)
downloadguile-6a4be32986a1af4aa6cab917b3b62f90b3436476.tar.gz
Fixed garbage collection of ports: basics work (no SMOBs, no guardians, no WHT).
* libguile/gc.c (scm_init_storage): Do not initialize SCM_I_PORT_TABLE here: this is done in `scm_ports_prehistory ()'. This fixes the bug mentioned in the previous patch log. * libguile/ports.c (scm_new_port_table_entry): Slightly clarified the code. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-4
-rw-r--r--libguile/gc.c6
-rw-r--r--libguile/ports.c6
2 files changed, 3 insertions, 9 deletions
diff --git a/libguile/gc.c b/libguile/gc.c
index eb2e15c3c..df78a62b3 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -720,12 +720,6 @@ scm_init_storage ()
j = SCM_HEAP_SEG_SIZE;
- /* Initialise the list of ports. */
- scm_i_port_table = (scm_t_port **)
- malloc (sizeof (scm_t_port *) * scm_i_port_table_room);
- if (!scm_i_port_table)
- return 1;
-
#if 0
/* We can't have a cleanup handler since we have no thread to run it
in. */
diff --git a/libguile/ports.c b/libguile/ports.c
index a8d06e0fb..e59e773da 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -500,13 +500,13 @@ scm_new_port_table_entry (scm_t_bits tag)
/* initial malloc is in gc.c. this doesn't use scm_gc_malloc etc.,
since it can never be freed during gc. */
/* XXX (Ludo): Why not do it actually? */
+ size_t new_size = scm_i_port_table_room * 2;
void *newt = scm_gc_realloc ((char *) scm_i_port_table,
scm_i_port_table_room * sizeof (scm_t_port *),
- (size_t) (sizeof (scm_t_port *)
- * scm_i_port_table_room * 2),
+ new_size * sizeof (scm_t_port *),
"port-table");
scm_i_port_table = (scm_t_port **) newt;
- scm_i_port_table_room *= 2;
+ scm_i_port_table_room = new_size;
}
entry->entry = scm_i_port_table_size;