summaryrefslogtreecommitdiff
path: root/srfi/srfi-14.c
diff options
context:
space:
mode:
authorGary Houston <ghouston@arglist.com>2001-07-15 15:16:31 +0000
committerGary Houston <ghouston@arglist.com>2001-07-15 15:16:31 +0000
commit396f36cdbfe40800a6aeacbdf3ceca7ddbd1a962 (patch)
tree3ffb79e91213795c7ef679c908bcee759e56a0b2 /srfi/srfi-14.c
parent4be5d9762537a44720e31e135f084080f51df18b (diff)
downloadguile-396f36cdbfe40800a6aeacbdf3ceca7ddbd1a962.tar.gz
* srfi-14.c (scm_char_set_hash): recognise 0 instead of #f in the
opt arg to give default bound, as in final spec. don't allow negative bounds.
Diffstat (limited to 'srfi/srfi-14.c')
-rw-r--r--srfi/srfi-14.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/srfi/srfi-14.c b/srfi/srfi-14.c
index b18cb1251..e3fbbcc1e 100644
--- a/srfi/srfi-14.c
+++ b/srfi/srfi-14.c
@@ -178,20 +178,26 @@ SCM_DEFINE (scm_char_set_leq, "char-set<=", 0, 0, 1,
SCM_DEFINE (scm_char_set_hash, "char-set-hash", 1, 1, 0,
(SCM cs, SCM bound),
"Compute a hash value for the character set @var{cs}. If\n"
- "@var{bound} is given and not @code{#f}, it restricts the\n"
+ "@var{bound} is given and non-zero, it restricts the\n"
"returned value to the range 0 @dots{} @var{bound - 1}.")
#define FUNC_NAME s_scm_char_set_hash
{
+ const int default_bnd = 871;
int bnd;
long * p;
unsigned val = 0;
int k;
SCM_VALIDATE_SMOB (1, cs, charset);
- if (SCM_UNBNDP (bound) || SCM_FALSEP (bound))
- bnd = 871;
+
+ if (SCM_UNBNDP (bound))
+ bnd = default_bnd;
else
- SCM_VALIDATE_INUM_COPY (2, bound, bnd);
+ {
+ SCM_VALIDATE_INUM_MIN_COPY (2, bound, 0, bnd);
+ if (bnd == 0)
+ bnd = default_bnd;
+ }
p = (long *) SCM_SMOB_DATA (cs);
for (k = 0; k < SCM_CHARSET_SIZE - 1; k++)