[vala/wip/gee: 4/5] Sort the symbols using .sort
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/gee: 4/5] Sort the symbols using .sort
- Date: Wed, 21 Sep 2016 10:33:31 +0000 (UTC)
commit 441ef37b235c43e890f39a75ceb9175cca3df019
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date: Thu Jul 25 09:07:59 2013 +0200
Sort the symbols using .sort
https://bugzilla.gnome.org/show_bug.cgi?id=704754
vala/valacodewriter.vala | 22 ++--------------------
1 files changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 9e796ff..0f303be 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -290,26 +290,8 @@ public class Vala.CodeWriter : CodeVisitor {
return;
}
- 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);
- }
- }
+ var sorted_symbols = symbols.slice (0, symbols.size);
+ sorted_symbols.sort ();
foreach (Symbol sym in sorted_symbols) {
sym.accept (this);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]