]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codewriter: Use List.sort() instead of custom local implementation
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 18 Sep 2018 15:24:07 +0000 (17:24 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 18 Sep 2018 15:24:07 +0000 (17:24 +0200)
vala/valacodewriter.vala

index a65956133d9aa3042eb56f53242358cc25d3d9df..43b4312f648081d762de1ee7fc5306ff3c6927aa 100644 (file)
@@ -299,25 +299,8 @@ public class Vala.CodeWriter : CodeVisitor {
                }
 
                var sorted_symbols = new ArrayList<Symbol> ();
-               foreach (Symbol sym in symbols) {
-                       int left = 0;
-                       int right = sorted_symbols.size - 1;
-                       if (left > right || sym.name < sorted_symbols[left].name) {
-                               sorted_symbols.insert (0, sym);
-                       } else if (sym.name > sorted_symbols[right].name) {
-                               sorted_symbols.add (sym);
-                       } else {
-                               while (right - left > 1) {
-                                       int i = (right + left) / 2;
-                                       if (sym.name > sorted_symbols[i].name) {
-                                               left = i;
-                                       } else {
-                                               right = i;
-                                       }
-                               }
-                               sorted_symbols.insert (left + 1, sym);
-                       }
-               }
+               sorted_symbols.add_all (symbols);
+               sorted_symbols.sort ((a, b) => strcmp (a.name, b.name));
                foreach (Symbol sym in sorted_symbols) {
                        sym.accept (this);
                }