X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fgrob-property.cc;h=5842662757b4650bba19c7fd5f68f5fd8f0dbe97;hb=aa2b5b377586a52fcb6b14d4dd464b94f6738560;hp=260b6700c47d0ab0b45d14b362bfef645a0659ca;hpb=c5d9f09505f28e5b44c7070fd88a841a271b8028;p=lilypond.git diff --git a/lily/grob-property.cc b/lily/grob-property.cc index 260b6700c4..5842662757 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -314,24 +314,34 @@ Grob::internal_has_interface (SCM k) } SCM -call_pure_function (SCM unpure, SCM args, int start, int end) +call_pure_function (SCM value, SCM args, int start, int end) { - if (Unpure_pure_container *upc = unsmob (unpure)) + if (Unpure_pure_container *upc = unsmob (value)) { - SCM pure = upc->pure_part (); + if (upc->is_unchanging ()) + { + // Don't bother forming an Unpure_pure_call here. + value = upc->unpure_part (); + + if (ly_is_procedure (value)) + return scm_apply_0 (value, args); + return value; + } + + value = upc->pure_part (); - if (ly_is_procedure (pure)) - return scm_apply_0 (pure, - scm_append (scm_list_2 (scm_list_3 (scm_car (args), - scm_from_int (start), - scm_from_int (end)), - scm_cdr (args)))); + if (ly_is_procedure (value)) + return scm_apply_3 (value, + scm_car (args), + scm_from_int (start), + scm_from_int (end), + scm_cdr (args)); - return pure; + return value; } - if (!ly_is_procedure (unpure)) - return unpure; + if (!ly_is_procedure (value)) + return value; return SCM_BOOL_F; }