1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00

(scm_set_smob_apply): Back out scm_remember_upto_here_1 addition from

yesterday.  It worked, but wasn't the "right" fix since tc is not
subject to GC and has the wrong type.  Instead, rearrange the code in
a way that also avoids the segfault.  Thanks to Sam Hocevar.
This commit is contained in:
Rob Browning 2004-09-20 05:43:15 +00:00
parent 90dab4b852
commit 6ce15cabc5

View file

@ -349,7 +349,8 @@ scm_set_smob_apply (scm_t_bits tc, SCM (*apply) (),
SCM (*apply_1) (SCM, SCM);
SCM (*apply_2) (SCM, SCM, SCM);
SCM (*apply_3) (SCM, SCM, SCM, SCM);
int type = SCM_GSUBR_MAKTYPE (req, opt, rst);
const int type = SCM_GSUBR_MAKTYPE (req, opt, rst);
const long i = SCM_TC2SMOBNUM (tc);
if (rst > 1 || req + opt + rst > 3)
{
@ -443,13 +444,15 @@ scm_set_smob_apply (scm_t_bits tc, SCM (*apply) (),
apply_3 = scm_smob_apply_3_error; break;
}
scm_smobs[SCM_TC2SMOBNUM (tc)].apply = apply;
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_0 = apply_0;
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_1 = apply_1;
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_2 = apply_2;
scm_smobs[SCM_TC2SMOBNUM (tc)].apply_3 = apply_3;
scm_smobs[SCM_TC2SMOBNUM (tc)].gsubr_type = type;
scm_remember_upto_here_1 (tc);
/* We compute i above and use it below because just using
SCM_TC2SMOBNUM (tc) directly as the array index below was causing
a build segfault on m68k machines */
scm_smobs[i].apply = apply;
scm_smobs[i].apply_0 = apply_0;
scm_smobs[i].apply_1 = apply_1;
scm_smobs[i].apply_2 = apply_2;
scm_smobs[i].apply_3 = apply_3;
scm_smobs[i].gsubr_type = type;
}
SCM