[libgee] Fix Gee.List.Iterator.next
- From: Maciej Marcin Piechotka <mpiechotka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgee] Fix Gee.List.Iterator.next
- Date: Sun, 25 Nov 2012 18:36:38 +0000 (UTC)
commit b2252d96993016d1696d59697a7c1db563992d41
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date: Sun Nov 25 18:32:39 2012 +0000
Fix Gee.List.Iterator.next
gee/linkedlist.vala | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/gee/linkedlist.vala b/gee/linkedlist.vala
index 52e74c9..54e7cf8 100644
--- a/gee/linkedlist.vala
+++ b/gee/linkedlist.vala
@@ -447,18 +447,30 @@ public class Gee.LinkedList<G> : AbstractBidirList<G>, Queue<G>, Deque<G> {
public bool next () {
assert (this._stamp == this._list._stamp);
- if (this.removed && this.position != null) {
- this.removed = false;
- return true;
- } else if (!this.started && this._list._head != null) {
- this.started = true;
- this.position = this._list._head;
- this._index++;
- return true;
- } else if (this.position != null && this.position.next != null) {
- this.position = this.position.next;
- this._index++;
- return true;
+ if (this.removed) {
+ if (this.position != null) {
+ this.removed = false;
+ return true;
+ } else {
+ return false;
+ }
+ } else if (!this.started) {
+ if (this._list._head != null) {
+ this.started = true;
+ this.position = this._list._head;
+ this._index++;
+ return true;
+ } else {
+ return false;
+ }
+ } else if (this.position != null) {
+ if (this.position.next != null) {
+ this.position = this.position.next;
+ this._index++;
+ return true;
+ } else {
+ return false;
+ }
}
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]