]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/context-def.cc
* lily/timing-engraver.cc (process_music): robustness fix.
[lilypond.git] / lily / context-def.cc
index a17eb49954d38e43a249e0be5d2ad48982627d3c..b5d0d940cc8f0fd7e76a6c043f96a39a22e61dc1 100644 (file)
@@ -227,12 +227,9 @@ Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
        = g->path_to_acceptable_context (type_sym, odef);
       if (result.size () && result.size () < best_depth)
        {
+         best_depth = result.size ();
          result.insert (g, 0);
          best_result = result;
-
-         /* this following line was added in 1.9.3, but hsould've been
-            there all along... Let's hope it doesn't cause nightmares.  */
-         best_depth = result.size ();
        }
     }
 
@@ -268,14 +265,13 @@ Context_def::get_translator_names (SCM user_mod) const
 SCM
 filter_performers (SCM ell)
 {
-  for (SCM *tail = &ell; scm_is_pair (*tail); tail = SCM_CDRLOC (*tail))
+  SCM *tail = &ell;
+  for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
     {
       if (dynamic_cast<Performer *> (unsmob_translator (scm_car (*tail))))
-       {
-         *tail = scm_cdr (*tail);
-         if (!scm_is_pair (*tail))
-           break;
-       }
+       *tail = scm_cdr (*tail);
+      else
+       tail = SCM_CDRLOC(*tail);
     }
   return ell;
 }
@@ -284,14 +280,12 @@ SCM
 filter_engravers (SCM ell)
 {
   SCM *tail = &ell;
-  for (; scm_is_pair (*tail); tail = SCM_CDRLOC (*tail))
+  for (SCM p = ell; scm_is_pair (p); p = scm_cdr (p))
     {
       if (dynamic_cast<Engraver *> (unsmob_translator (scm_car (*tail))))
-       {
-         *tail = scm_cdr (*tail);
-         if (!scm_is_pair (*tail))
-           break;
-       }
+       *tail = scm_cdr (*tail);
+      else
+       tail = SCM_CDRLOC(*tail);
     }
   return ell;
 }