diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-01-18 18:47:20 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-01-18 18:47:20 +0100 |
commit | 0953b549464e5bf1433e7f0b8a49ac4b464c3c11 (patch) | |
tree | 77b672ffdafac282c27de444bc6140531df58613 /libguile/goops.c | |
parent | 474554694f5618be238054e736540f567a0e02a0 (diff) | |
download | guile-0953b549464e5bf1433e7f0b8a49ac4b464c3c11.tar.gz |
Publish the maximum number of port types as `SCM_I_MAX_PORT_TYPE_COUNT'.
* libguile/goops.c (create_port_classes): Use
`SCM_I_MAX_PORT_TYPE_COUNT' instead of a hard-wired 256.
* libguile/objects.h (SCM_OUT_PCLASS_INDEX, SCM_INOUT_PCLASS_INDEX):
Likewise.
* libguile/ports.c (scm_make_port_type): Likewise.
* libguile/ports.h (SCM_I_MAX_PORT_TYPE_COUNT): New macro.
Diffstat (limited to 'libguile/goops.c')
-rw-r--r-- | libguile/goops.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libguile/goops.c b/libguile/goops.c index 61f81e6c5..1c61d10ae 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -2741,9 +2741,10 @@ create_port_classes (void) { long i; - scm_port_class = (SCM *) scm_malloc (3 * 256 * sizeof (SCM)); - for (i = 0; i < 3 * 256; ++i) - scm_port_class[i] = 0; + /* Allocate 3 times the maximum number of port types so that input ports, + output ports, and in/out ports can be stored at different offsets. See + `SCM_IN_PCLASS_INDEX' et al. */ + scm_port_class = scm_calloc (3 * SCM_I_MAX_PORT_TYPE_COUNT * sizeof (SCM)); for (i = 0; i < scm_numptob; ++i) scm_make_port_classes (i, SCM_PTOBNAME (i)); |