Reviewers: hanwenn, Message: In the review for the first attempt, David wrote: > It's probably more an academical remark, but a "kosher" way of doing that might > be using scm_to_int (scm_length (...)) instead of scm_ilength (...). etc.
I'll make this change because setting a good example is valuable. Description: https://sourceforge.net/p/testlilyissues/issues/5705/ Please review this at https://codereview.appspot.com/565610043/ Affected files (+5, -2 lines): M lily/stem.cc Index: lily/stem.cc diff --git a/lily/stem.cc b/lily/stem.cc index 7f1983bc641f0fc969d62fbbecfc8e1dea870466..2b3c9cc202400183075dbf1a1beaba6bcaf91fb5 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -93,8 +93,11 @@ Stem::get_beaming (Grob *me, Direction d) SCM lst = index_get_cell (pair, d); - int len = scm_ilength (lst); // -1 for dotted lists! - return std::max (len, 0); + long len = scm_ilength (lst); // -1 for dotted lists! + // TODO: scm_ilength () is O(n), so we don't want to call it for long lists. + // If scm_ilength () is OK, this cast should be OK too. The question is, are + // we confident that the list is short? + return static_cast<int> (std::max (len, 0L)); } Interval
