]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lyric-engraver.cc
Issue 4427: clean up finding & changing of contexts in C++
[lilypond.git] / lily / lyric-engraver.cc
index 58b8f6cdd294e7a6a17907d75c8e4e9418d3c542..fadb35d6b4c8dd3d10e7a541b5bdabc80da2d1b7 100644 (file)
@@ -116,26 +116,11 @@ get_voice_to_lyrics (Context *lyrics)
   if (!scm_is_symbol (voice_type))
     return 0;
 
-  Context *parent = lyrics;
-  Context *voice = 0;
-  while (parent && !voice)
-    {
-      voice = find_context_below (parent, voice_type, nm);
-      parent = parent->get_parent_context ();
-    }
-
+  Context *voice = find_context_near (lyrics, voice_type, nm);
   if (voice)
     return voice;
 
-  parent = lyrics;
-  voice = 0;
-  while (parent && !voice)
-    {
-      voice = find_context_below (parent, voice_type, "");
-      parent = parent->get_parent_context ();
-    }
-
-  return voice;
+  return find_context_near (lyrics, voice_type, "");
 }
 
 Grob *