diff options
author | Andy Wingo <wingo@pobox.com> | 2009-12-05 12:38:32 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-12-05 12:38:43 +0100 |
commit | e7efe8e793fa51ea898aea4477939c598b3e9fac (patch) | |
tree | 3fb9dfab7a0d398351b5067d91a0235d1910ddbc /libguile/numbers.c | |
parent | 838aa0007073dbb9e8c91810299c47054ded52bd (diff) | |
download | guile-e7efe8e793fa51ea898aea4477939c598b3e9fac.tar.gz |
decruftify scm_sys_protects
* libguile/root.h
* libguile/root.c (scm_sys_protects): It used to be that for some reason
we'd define a special array of "protected" values. This was a little
silly, always, but with the BDW GC it's completely unnecessary. Also
many of these variables were unused, and none of them were good API.
So remove this array, and either eliminate, make static, or make
internal the various values.
* libguile/snarf.h: No need to generate calls to scm_permanent_object.
* guile-readline/readline.c (scm_init_readline): No need to call
scm_permanent_object.
* libguile/array-map.c (ramap, rafe): Remove the dubious nullvect
optimizations.
* libguile/async.c (scm_init_async): No need to init scm_asyncs, it is
no more.
* libguile/eval.c (scm_init_eval): No need to init scm_listofnull, it is
no more.
* libguile/gc.c: Make scm_protects a static var.
(scm_storage_prehistory): Change the sanity check to use the address
of protects.
(scm_init_gc_protect_object): No need to clear the scm_sys_protects,
as it is no more.
* libguile/keywords.c: Make the keyword obarray a static var.
* libguile/numbers.c: Make flo0 a static var.
* libguile/objprop.c: Make object_whash a static var.
* libguile/properties.c: Make properties_whash a static var.
* libguile/srcprop.h:
* libguile/srcprop.c: Make scm_source_whash a global with internal
linkage.
* libguile/strings.h:
* libguile/strings.c: Make scm_nullstr a global with internal linkage.
* libguile/vectors.c (scm_init_vectors): No need to init scm_nullvect,
it's unused.
Diffstat (limited to 'libguile/numbers.c')
-rw-r--r-- | libguile/numbers.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c index 6232ddc6c..358a1cdf8 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -98,6 +98,8 @@ /* the macro above will not work as is with fractions */ +static SCM flo0; + #define SCM_SWAP(x, y) do { SCM __t = x; x = y; y = __t; } while (0) /* FLOBUFLEN is the maximum number of characters neccessary for the @@ -5828,7 +5830,7 @@ scm_imag_part (SCM z) else if (SCM_BIGP (z)) return SCM_INUM0; else if (SCM_REALP (z)) - return scm_flo0; + return flo0; else if (SCM_COMPLEXP (z)) return scm_from_double (SCM_COMPLEX_IMAG (z)); else if (SCM_FRACTIONP (z)) @@ -5923,13 +5925,13 @@ SCM scm_angle (SCM z) { /* atan(0,-1) is pi and it'd be possible to have that as a constant like - scm_flo0 to save allocating a new flonum with scm_from_double each time. + flo0 to save allocating a new flonum with scm_from_double each time. But if atan2 follows the floating point rounding mode, then the value is not a constant. Maybe it'd be close enough though. */ if (SCM_I_INUMP (z)) { if (SCM_I_INUM (z) >= 0) - return scm_flo0; + return flo0; else return scm_from_double (atan2 (0.0, -1.0)); } @@ -5940,12 +5942,12 @@ scm_angle (SCM z) if (sgn < 0) return scm_from_double (atan2 (0.0, -1.0)); else - return scm_flo0; + return flo0; } else if (SCM_REALP (z)) { if (SCM_REAL_VALUE (z) >= 0) - return scm_flo0; + return flo0; else return scm_from_double (atan2 (0.0, -1.0)); } @@ -5954,7 +5956,7 @@ scm_angle (SCM z) else if (SCM_FRACTIONP (z)) { if (scm_is_false (scm_negative_p (SCM_FRACTION_NUMERATOR (z)))) - return scm_flo0; + return flo0; else return scm_from_double (atan2 (0.0, -1.0)); } else @@ -6594,7 +6596,7 @@ scm_init_numbers () scm_add_feature ("complex"); scm_add_feature ("inexact"); - scm_flo0 = scm_from_double (0.0); + flo0 = scm_from_double (0.0); /* determine floating point precision */ for (i=2; i <= SCM_MAX_DBL_RADIX; ++i) |