From 43fe858eb18418ae1d8867786ad873b7a4e2ae8a Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 30 Jun 2012 15:06:44 +0200 Subject: [PATCH] Fix description in lily/include/smobs.hh --- lily/include/smobs.hh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index cd28a29c3f..fb4fa530ee 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -46,7 +46,7 @@ The constructor for a complex smob should have 3 steps: - * initialize all SCM members to a non-immediate value (like SCM_EOL) + * initialize all SCM members to an immediate value (like SCM_EOL) * call smobify_self () @@ -67,7 +67,13 @@ Complex_smob *p = new Complex_smob; list = scm_cons (p->self_scm (), list); - scm_gc_unprotect_object (p->self_scm ()); + p->unprotect (); + + Since unprotect returns the SCM object itself, this particular case + can be written as + + Complex_smob *p = new Complex_smob; + list = scm_cons (p->unprotect (), list); Complex smobs are made with DECLARE_SMOBS (Classname) in the class declaration. -- 2.39.5