Guile Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New smob interface

Klaus Schilling <> 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 z;
 SCM_NEWSMOB (z, WINDOW_type, w);
 return z;

Guile Home | Main Index | Thread Index