X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fsmobs.tcc;h=f76609bf5b96ac8fca532f4cb975d109c0ac8b2c;hb=0c14539bc83d6bb405141b6f21430b33d1e8fcf0;hp=7b5179256709db8570a1137109a6b1f9f14bfa4b;hpb=6a3232e75d94f1b0c72c2fc986bc2c65d7e51823;p=lilypond.git diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc index 7b51792567..f76609bf5b 100644 --- a/lily/include/smobs.tcc +++ b/lily/include/smobs.tcc @@ -1,7 +1,7 @@ /* -*- C++ -*- This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2014 Han-Wen Nienhuys + Copyright (C) 2005--2015 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,14 +32,20 @@ template SCM Smob_base::mark_trampoline (SCM arg) { - return (Super::unsmob (arg))->mark_smob (); + Super *ptr = unsmob (arg); + if (ptr) + return ptr->mark_smob (); + return SCM_UNDEFINED; } template int Smob_base::print_trampoline (SCM arg, SCM port, scm_print_state *p) { - return (Super::unsmob (arg))->print_smob (port, p); + Super *ptr = unsmob (arg); + if (ptr) + return ptr->print_smob (port, p); + return 0; } template @@ -96,6 +102,7 @@ Smob_base::unregister_ptr (SCM obj) { Super *p = Super::unchecked_unsmob (obj); scm_gc_unregister_collectable_memory (p, sizeof (*p), smob_name_.c_str ()); + SCM_SET_SMOB_DATA (obj, static_cast (0)); return p; } @@ -103,7 +110,7 @@ template scm_t_bits Smob_base::smob_tag_ = 0; template -Scm_init Smob_base::scm_init_ = init; +Scm_init Smob_base::scm_init_ (init); template string Smob_base::smob_name_; @@ -128,10 +135,7 @@ void Smob_base::init () if (&Super::free_smob != &Smob_base::free_smob) scm_set_smob_free (smob_tag_, Super::free_smob); - // Old GCC versions refuse comparing pointers-to-member-function of - // covariant types, so we recast here. - if (&Super::mark_smob != - static_cast(&Smob_base::mark_smob)) + if (&Super::mark_smob != &Smob_base::mark_smob) scm_set_smob_mark (smob_tag_, Super::mark_trampoline); scm_set_smob_print (smob_tag_, Super::print_trampoline); if (&Super::equal_p != &Smob_base::equal_p) @@ -147,11 +151,6 @@ void Smob_base::init () scm_c_export (Super::type_p_name_, NULL); } ly_add_type_predicate ((void *) is_smob, smob_name_.c_str ()); - if (Super::smob_proc_signature_ >= 0) - scm_set_smob_apply (smob_tag_, - (scm_t_subr)Super::smob_proc, - Super::smob_proc_signature_ >> 8, - (Super::smob_proc_signature_ >> 4)&0xf, - Super::smob_proc_signature_ & 0xf); + Super::smob_proc_init (smob_tag_); } #endif