GC_PROTECT some variables.

This commit is contained in:
mainzelm 2003-05-01 10:20:17 +00:00
parent fd4634e27f
commit c5d8b5d1b4
1 changed files with 14 additions and 1 deletions

View File

@ -117,6 +117,12 @@ static double mrg32k3a(state_t *s) { /* (double), in {0..m1-1} */
s48_value mrg32k3a_pack_state1(s48_value state) { s48_value mrg32k3a_pack_state1(s48_value state) {
s48_value result; s48_value result;
state_t s; state_t s;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(state); /* s48_extract_integer may GC */
result = S48_MAKE_VALUE(state_t);
#define REF(i) (double)s48_extract_integer(S48_VECTOR_REF(state, (long)(i))) #define REF(i) (double)s48_extract_integer(S48_VECTOR_REF(state, (long)(i)))
@ -130,6 +136,8 @@ s48_value mrg32k3a_pack_state1(s48_value state) {
#undef REF #undef REF
S48_GC_UNPROTECT();
/* box s into a Scheme object */ /* box s into a Scheme object */
result = S48_MAKE_VALUE(state_t); result = S48_MAKE_VALUE(state_t);
S48_SET_VALUE(result, state_t, s); S48_SET_VALUE(result, state_t, s);
@ -137,9 +145,12 @@ s48_value mrg32k3a_pack_state1(s48_value state) {
} }
s48_value mrg32k3a_unpack_state1(s48_value state) { s48_value mrg32k3a_unpack_state1(s48_value state) {
s48_value result; s48_value result = S48_UNSPECIFIC;
state_t s; state_t s;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(result);
/* unbox s from the Scheme object */ /* unbox s from the Scheme object */
s = S48_EXTRACT_VALUE(state, state_t); s = S48_EXTRACT_VALUE(state, state_t);
@ -161,6 +172,8 @@ s48_value mrg32k3a_unpack_state1(s48_value state) {
#undef SET #undef SET
S48_GC_UNPROTECT();
return result; return result;
} }