This is the mail archive of the
mailing list for the Guile project.
Re: New smob interface
Klaus Schilling <Klaus.Schilling@home.ivm.de> writes:
It's not very critical exactly where you put the call to
scm_done_malloc since this is used by the GC to judge when it is
suitable to trigger a new GC.
But, it's not a good idea to do it between gh_defer and gh_allow and
it is more suitable to do it after, so I'd say put it right after
> I just noticed , in addition, that my SCM2WINDOW does not even check
> whether the smob is of the correct type, and that should be done as
> soon as possible , similar as in the old implementation , where one
> checked the CAR of the object's cell against the tag of the smob type.
> How would one do that under the new interface?
It's done the same way as before (which is not to use SCM_CAR even
though that happens to work right now):
#define SCM_WINDOWP(x) (SCM_TYP16 (x) == WINDOW_type)
SCM WINDOW2SCM (WINDOW *w)
SCM_ASSERT (SCM_NIMP (x) && SCM_WINDOWP (x), x, SCM_ARG1, "WINDOW2SCM");
SCM_NEWSMOB (z, WINDOW_type, w);