1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

* 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.
This commit is contained in:
Gary Houston 2001-07-15 15:20:31 +00:00
parent 072cb6f740
commit f1a928f435
2 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2001-07-15 Gary Houston <ghouston@arglist.com>
* 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.
2001-07-13 Marius Vollmer <mvo@zagadka.ping.de>
* srfi-2.scm (and-let*): Use `re-export-syntax' instead of

View file

@ -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++)