X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob-interface-scheme.cc;h=11a5576169761bf4c4c436d7deb92e3b96bce9bc;hb=4d405ef96a8a62771d7d9a283ff5369a772e89d8;hp=7a7749b87037bf6824a82ca8c6862e3a30a46fac;hpb=b7a0cffbf9d1069860368f289a5b50e9d1d90ba8;p=lilypond.git diff --git a/lily/grob-interface-scheme.cc b/lily/grob-interface-scheme.cc index 7a7749b870..11a5576169 100644 --- a/lily/grob-interface-scheme.cc +++ b/lily/grob-interface-scheme.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2005--2009 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 @@ -19,30 +19,27 @@ #include "lily-guile.hh" #include "std-string.hh" +#include "protected-scm.hh" -static SCM all_ifaces; +static Protected_scm all_ifaces; void internal_add_interface (SCM a, SCM b, SCM c) { - if (!all_ifaces) - { - SCM tab = scm_c_make_hash_table (59); - all_ifaces = tab; - scm_permanent_object (tab); - } - - SCM entry = scm_list_n (a, b, c, SCM_UNDEFINED); + if (!all_ifaces.is_bound ()) + all_ifaces = scm_c_make_hash_table (59); + + SCM entry = scm_list_3 (a, b, c); scm_hashq_set_x (all_ifaces, a, entry); } LY_DEFINE (ly_add_interface, "ly:add-interface", - 3, 0, 0, (SCM iface, SCM desc, SCM props), - "Add a new grob interface. @var{iface} is the" - " interface name, @var{desc} is the interface" - " description, and @var{props} is the list of" - " user-settable properties for the interface.") + 3, 0, 0, (SCM iface, SCM desc, SCM props), + "Add a new grob interface. @var{iface} is the" + " interface name, @var{desc} is the interface" + " description, and @var{props} is the list of" + " user-settable properties for the interface.") { LY_ASSERT_TYPE (ly_is_symbol, iface, 1); LY_ASSERT_TYPE (scm_is_string, desc, 2); @@ -54,8 +51,8 @@ LY_DEFINE (ly_add_interface, "ly:add-interface", } LY_DEFINE (ly_all_grob_interfaces, "ly:all-grob-interfaces", - 0, 0, 0, (), - "Return the hash table with all grob interface descriptions.") + 0, 0, 0, (), + "Return the hash table with all grob interface descriptions.") { return all_ifaces; }