mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Publish the maximum number of SMOB types as `SCM_I_MAX_SMOB_TYPE_COUNT'.
* libguile/goops.c (create_smob_classes): Refer to `SCM_I_MAX_SMOB_TYPE_COUNT' rather than 255 (which is wrong) or 256. * libguile/smob.c (MAX_SMOB_COUNT): Alias for `SCM_I_MAX_SMOB_TYPE_COUNT'. * libguile/smob.h (SCM_I_MAX_SMOB_TYPE_COUNT): New macro.
This commit is contained in:
parent
c010924a71
commit
202271f291
3 changed files with 9 additions and 5 deletions
|
@ -2694,8 +2694,8 @@ create_smob_classes (void)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
scm_smob_class = (SCM *) scm_malloc (255 * sizeof (SCM));
|
scm_smob_class = scm_malloc (SCM_I_MAX_SMOB_TYPE_COUNT * sizeof (SCM));
|
||||||
for (i = 0; i < 255; ++i)
|
for (i = 0; i < SCM_I_MAX_SMOB_TYPE_COUNT; ++i)
|
||||||
scm_smob_class[i] = 0;
|
scm_smob_class[i] = 0;
|
||||||
|
|
||||||
scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_keyword)] = scm_class_keyword;
|
scm_smob_class[SCM_TC2SMOBNUM (scm_tc16_keyword)] = scm_class_keyword;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2003, 2004, 2006, 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -45,7 +45,8 @@
|
||||||
* tags for smobjects (if you know a tag you can get an index and conversely).
|
* tags for smobjects (if you know a tag you can get an index and conversely).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX_SMOB_COUNT 256
|
#define MAX_SMOB_COUNT SCM_I_MAX_SMOB_TYPE_COUNT
|
||||||
|
|
||||||
long scm_numsmob;
|
long scm_numsmob;
|
||||||
scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT];
|
scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT];
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#ifndef SCM_SMOB_H
|
#ifndef SCM_SMOB_H
|
||||||
#define SCM_SMOB_H
|
#define SCM_SMOB_H
|
||||||
|
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006, 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -112,6 +112,9 @@ do { \
|
||||||
#define SCM_SMOB_APPLY_2(x, a1, a2) (SCM_SMOB_DESCRIPTOR (x).apply_2 (x, (a1), (a2)))
|
#define SCM_SMOB_APPLY_2(x, a1, a2) (SCM_SMOB_DESCRIPTOR (x).apply_2 (x, (a1), (a2)))
|
||||||
#define SCM_SMOB_APPLY_3(x, a1, a2, rst) (SCM_SMOB_DESCRIPTOR (x).apply_3 (x, (a1), (a2), (rst)))
|
#define SCM_SMOB_APPLY_3(x, a1, a2, rst) (SCM_SMOB_DESCRIPTOR (x).apply_3 (x, (a1), (a2), (rst)))
|
||||||
|
|
||||||
|
/* Maximum number of SMOB types. */
|
||||||
|
#define SCM_I_MAX_SMOB_TYPE_COUNT 256
|
||||||
|
|
||||||
SCM_API long scm_numsmob;
|
SCM_API long scm_numsmob;
|
||||||
SCM_API scm_smob_descriptor scm_smobs[];
|
SCM_API scm_smob_descriptor scm_smobs[];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue