This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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
gh_allow.

> 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 z;
 SCM_ASSERT (SCM_NIMP (x) && SCM_WINDOWP (x), x, SCM_ARG1, "WINDOW2SCM");
 SCM_NEWSMOB (z, WINDOW_type, w);
 return z;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]