]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/smobs.tcc
Issue 4135/2: Replace mark_smob static member functions with non-static members
[lilypond.git] / lily / include / smobs.tcc
index f990a08f539abbb94120ac559b9be310374f7a30..c2616b321692ec431f4c0dea55370872b0ab976f 100644 (file)
 #include "smobs.hh"
 #include <typeinfo>
 
+template <class Super>
+SCM
+Smob_base<Super>::mark_trampoline (SCM arg)
+{
+  return (Super::unsmob (arg))->mark_smob ();
+}
+
 template <class Super>
 SCM
 Smob_base<Super>::register_ptr (Super *p)
@@ -42,6 +49,14 @@ Smob_base<Super>::register_ptr (Super *p)
   return s;
 }
 
+// Default, should not actually get called
+template <class Super>
+SCM
+Smob_base<Super>::mark_smob ()
+{
+  return SCM_UNSPECIFIED;
+}
+
 template <class Super>
 int
 Smob_base<Super>::print_smob (SCM, SCM p, scm_print_state *)
@@ -90,8 +105,8 @@ void Smob_base<Super>::init ()
 
   if (Super::free_smob != 0)
     scm_set_smob_free (smob_tag_, Super::free_smob);
-  if (Super::mark_smob != 0)
-    scm_set_smob_mark (smob_tag_, Super::mark_smob);
+  if (&Super::mark_smob != &Smob_base<Super>::mark_smob)
+    scm_set_smob_mark (smob_tag_, Super::mark_trampoline);
   if (Super::print_smob != 0)
     scm_set_smob_print (smob_tag_, Super::print_smob);
   if (Super::equal_p != 0)