summaryrefslogtreecommitdiffhomepage
path: root/pkg/waiter
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/waiter')
-rwxr-xr-xpkg/waiter/waiter_list.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/pkg/waiter/waiter_list.go b/pkg/waiter/waiter_list.go
index 00b304a31..02fdb730d 100755
--- a/pkg/waiter/waiter_list.go
+++ b/pkg/waiter/waiter_list.go
@@ -54,8 +54,9 @@ func (l *waiterList) Back() *Entry {
// PushFront inserts the element e at the front of list l.
func (l *waiterList) PushFront(e *Entry) {
- waiterElementMapper{}.linkerFor(e).SetNext(l.head)
- waiterElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := waiterElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
waiterElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *waiterList) PushFront(e *Entry) {
// PushBack inserts the element e at the back of list l.
func (l *waiterList) PushBack(e *Entry) {
- waiterElementMapper{}.linkerFor(e).SetNext(nil)
- waiterElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := waiterElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
waiterElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *waiterList) PushBackList(m *waiterList) {
// InsertAfter inserts e after b.
func (l *waiterList) InsertAfter(b, e *Entry) {
- a := waiterElementMapper{}.linkerFor(b).Next()
- waiterElementMapper{}.linkerFor(e).SetNext(a)
- waiterElementMapper{}.linkerFor(e).SetPrev(b)
- waiterElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := waiterElementMapper{}.linkerFor(b)
+ eLinker := waiterElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
waiterElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *waiterList) InsertAfter(b, e *Entry) {
// InsertBefore inserts e before a.
func (l *waiterList) InsertBefore(a, e *Entry) {
- b := waiterElementMapper{}.linkerFor(a).Prev()
- waiterElementMapper{}.linkerFor(e).SetNext(a)
- waiterElementMapper{}.linkerFor(e).SetPrev(b)
- waiterElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := waiterElementMapper{}.linkerFor(a)
+ eLinker := waiterElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
waiterElementMapper{}.linkerFor(b).SetNext(e)