summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-03 22:13:29 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-03 22:13:29 +0000
commit5f5127ba9ddb8f52d43827b6ab96b8169af5075f (patch)
tree701124de37c5bf475ba6920641948d637da0ee8b /pkg/tcpip
parent56f91c540e938374a025c31cf23aa2e4d00cacec (diff)
parent844e4d284cddf9795a0db7c38f926fe7b49bb873 (diff)
Merge release-20200219.0-91-g844e4d2 (automated)
Diffstat (limited to 'pkg/tcpip')
-rwxr-xr-xpkg/tcpip/network/fragmentation/reassembler_list.go33
-rwxr-xr-xpkg/tcpip/stack/linkaddrentry_list.go33
-rwxr-xr-xpkg/tcpip/transport/icmp/icmp_packet_list.go33
-rwxr-xr-xpkg/tcpip/transport/packet/packet_list.go33
-rwxr-xr-xpkg/tcpip/transport/raw/raw_packet_list.go33
-rwxr-xr-xpkg/tcpip/transport/tcp/tcp_endpoint_list.go33
-rwxr-xr-xpkg/tcpip/transport/tcp/tcp_segment_list.go33
-rwxr-xr-xpkg/tcpip/transport/udp/udp_packet_list.go33
8 files changed, 168 insertions, 96 deletions
diff --git a/pkg/tcpip/network/fragmentation/reassembler_list.go b/pkg/tcpip/network/fragmentation/reassembler_list.go
index 3189cae29..d571d7ae5 100755
--- a/pkg/tcpip/network/fragmentation/reassembler_list.go
+++ b/pkg/tcpip/network/fragmentation/reassembler_list.go
@@ -54,8 +54,9 @@ func (l *reassemblerList) Back() *reassembler {
// PushFront inserts the element e at the front of list l.
func (l *reassemblerList) PushFront(e *reassembler) {
- reassemblerElementMapper{}.linkerFor(e).SetNext(l.head)
- reassemblerElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := reassemblerElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
reassemblerElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *reassemblerList) PushFront(e *reassembler) {
// PushBack inserts the element e at the back of list l.
func (l *reassemblerList) PushBack(e *reassembler) {
- reassemblerElementMapper{}.linkerFor(e).SetNext(nil)
- reassemblerElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := reassemblerElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
reassemblerElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *reassemblerList) PushBackList(m *reassemblerList) {
// InsertAfter inserts e after b.
func (l *reassemblerList) InsertAfter(b, e *reassembler) {
- a := reassemblerElementMapper{}.linkerFor(b).Next()
- reassemblerElementMapper{}.linkerFor(e).SetNext(a)
- reassemblerElementMapper{}.linkerFor(e).SetPrev(b)
- reassemblerElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := reassemblerElementMapper{}.linkerFor(b)
+ eLinker := reassemblerElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
reassemblerElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *reassemblerList) InsertAfter(b, e *reassembler) {
// InsertBefore inserts e before a.
func (l *reassemblerList) InsertBefore(a, e *reassembler) {
- b := reassemblerElementMapper{}.linkerFor(a).Prev()
- reassemblerElementMapper{}.linkerFor(e).SetNext(a)
- reassemblerElementMapper{}.linkerFor(e).SetPrev(b)
- reassemblerElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := reassemblerElementMapper{}.linkerFor(a)
+ eLinker := reassemblerElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
reassemblerElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/stack/linkaddrentry_list.go b/pkg/tcpip/stack/linkaddrentry_list.go
index 61a45ddcb..1494aeca1 100755
--- a/pkg/tcpip/stack/linkaddrentry_list.go
+++ b/pkg/tcpip/stack/linkaddrentry_list.go
@@ -54,8 +54,9 @@ func (l *linkAddrEntryList) Back() *linkAddrEntry {
// PushFront inserts the element e at the front of list l.
func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) {
- linkAddrEntryElementMapper{}.linkerFor(e).SetNext(l.head)
- linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := linkAddrEntryElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
linkAddrEntryElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *linkAddrEntryList) PushFront(e *linkAddrEntry) {
// PushBack inserts the element e at the back of list l.
func (l *linkAddrEntryList) PushBack(e *linkAddrEntry) {
- linkAddrEntryElementMapper{}.linkerFor(e).SetNext(nil)
- linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := linkAddrEntryElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
linkAddrEntryElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *linkAddrEntryList) PushBackList(m *linkAddrEntryList) {
// InsertAfter inserts e after b.
func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) {
- a := linkAddrEntryElementMapper{}.linkerFor(b).Next()
- linkAddrEntryElementMapper{}.linkerFor(e).SetNext(a)
- linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(b)
- linkAddrEntryElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := linkAddrEntryElementMapper{}.linkerFor(b)
+ eLinker := linkAddrEntryElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
linkAddrEntryElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *linkAddrEntryList) InsertAfter(b, e *linkAddrEntry) {
// InsertBefore inserts e before a.
func (l *linkAddrEntryList) InsertBefore(a, e *linkAddrEntry) {
- b := linkAddrEntryElementMapper{}.linkerFor(a).Prev()
- linkAddrEntryElementMapper{}.linkerFor(e).SetNext(a)
- linkAddrEntryElementMapper{}.linkerFor(e).SetPrev(b)
- linkAddrEntryElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := linkAddrEntryElementMapper{}.linkerFor(a)
+ eLinker := linkAddrEntryElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
linkAddrEntryElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/icmp/icmp_packet_list.go b/pkg/tcpip/transport/icmp/icmp_packet_list.go
index 1b35e5b4a..deeab60ae 100755
--- a/pkg/tcpip/transport/icmp/icmp_packet_list.go
+++ b/pkg/tcpip/transport/icmp/icmp_packet_list.go
@@ -54,8 +54,9 @@ func (l *icmpPacketList) Back() *icmpPacket {
// PushFront inserts the element e at the front of list l.
func (l *icmpPacketList) PushFront(e *icmpPacket) {
- icmpPacketElementMapper{}.linkerFor(e).SetNext(l.head)
- icmpPacketElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := icmpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
icmpPacketElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *icmpPacketList) PushFront(e *icmpPacket) {
// PushBack inserts the element e at the back of list l.
func (l *icmpPacketList) PushBack(e *icmpPacket) {
- icmpPacketElementMapper{}.linkerFor(e).SetNext(nil)
- icmpPacketElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := icmpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
icmpPacketElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *icmpPacketList) PushBackList(m *icmpPacketList) {
// InsertAfter inserts e after b.
func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) {
- a := icmpPacketElementMapper{}.linkerFor(b).Next()
- icmpPacketElementMapper{}.linkerFor(e).SetNext(a)
- icmpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- icmpPacketElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := icmpPacketElementMapper{}.linkerFor(b)
+ eLinker := icmpPacketElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
icmpPacketElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *icmpPacketList) InsertAfter(b, e *icmpPacket) {
// InsertBefore inserts e before a.
func (l *icmpPacketList) InsertBefore(a, e *icmpPacket) {
- b := icmpPacketElementMapper{}.linkerFor(a).Prev()
- icmpPacketElementMapper{}.linkerFor(e).SetNext(a)
- icmpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- icmpPacketElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := icmpPacketElementMapper{}.linkerFor(a)
+ eLinker := icmpPacketElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
icmpPacketElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/packet/packet_list.go b/pkg/tcpip/transport/packet/packet_list.go
index 0da0dfcb6..e8c4cba0d 100755
--- a/pkg/tcpip/transport/packet/packet_list.go
+++ b/pkg/tcpip/transport/packet/packet_list.go
@@ -54,8 +54,9 @@ func (l *packetList) Back() *packet {
// PushFront inserts the element e at the front of list l.
func (l *packetList) PushFront(e *packet) {
- packetElementMapper{}.linkerFor(e).SetNext(l.head)
- packetElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := packetElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
packetElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *packetList) PushFront(e *packet) {
// PushBack inserts the element e at the back of list l.
func (l *packetList) PushBack(e *packet) {
- packetElementMapper{}.linkerFor(e).SetNext(nil)
- packetElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := packetElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
packetElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *packetList) PushBackList(m *packetList) {
// InsertAfter inserts e after b.
func (l *packetList) InsertAfter(b, e *packet) {
- a := packetElementMapper{}.linkerFor(b).Next()
- packetElementMapper{}.linkerFor(e).SetNext(a)
- packetElementMapper{}.linkerFor(e).SetPrev(b)
- packetElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := packetElementMapper{}.linkerFor(b)
+ eLinker := packetElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
packetElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *packetList) InsertAfter(b, e *packet) {
// InsertBefore inserts e before a.
func (l *packetList) InsertBefore(a, e *packet) {
- b := packetElementMapper{}.linkerFor(a).Prev()
- packetElementMapper{}.linkerFor(e).SetNext(a)
- packetElementMapper{}.linkerFor(e).SetPrev(b)
- packetElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := packetElementMapper{}.linkerFor(a)
+ eLinker := packetElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
packetElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/raw/raw_packet_list.go b/pkg/tcpip/transport/raw/raw_packet_list.go
index 12edb4334..a0138e8cc 100755
--- a/pkg/tcpip/transport/raw/raw_packet_list.go
+++ b/pkg/tcpip/transport/raw/raw_packet_list.go
@@ -54,8 +54,9 @@ func (l *rawPacketList) Back() *rawPacket {
// PushFront inserts the element e at the front of list l.
func (l *rawPacketList) PushFront(e *rawPacket) {
- rawPacketElementMapper{}.linkerFor(e).SetNext(l.head)
- rawPacketElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := rawPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
rawPacketElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *rawPacketList) PushFront(e *rawPacket) {
// PushBack inserts the element e at the back of list l.
func (l *rawPacketList) PushBack(e *rawPacket) {
- rawPacketElementMapper{}.linkerFor(e).SetNext(nil)
- rawPacketElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := rawPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
rawPacketElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *rawPacketList) PushBackList(m *rawPacketList) {
// InsertAfter inserts e after b.
func (l *rawPacketList) InsertAfter(b, e *rawPacket) {
- a := rawPacketElementMapper{}.linkerFor(b).Next()
- rawPacketElementMapper{}.linkerFor(e).SetNext(a)
- rawPacketElementMapper{}.linkerFor(e).SetPrev(b)
- rawPacketElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := rawPacketElementMapper{}.linkerFor(b)
+ eLinker := rawPacketElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
rawPacketElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *rawPacketList) InsertAfter(b, e *rawPacket) {
// InsertBefore inserts e before a.
func (l *rawPacketList) InsertBefore(a, e *rawPacket) {
- b := rawPacketElementMapper{}.linkerFor(a).Prev()
- rawPacketElementMapper{}.linkerFor(e).SetNext(a)
- rawPacketElementMapper{}.linkerFor(e).SetPrev(b)
- rawPacketElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := rawPacketElementMapper{}.linkerFor(a)
+ eLinker := rawPacketElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
rawPacketElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
index 42e190060..32ac43dca 100755
--- a/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_endpoint_list.go
@@ -54,8 +54,9 @@ func (l *endpointList) Back() *endpoint {
// PushFront inserts the element e at the front of list l.
func (l *endpointList) PushFront(e *endpoint) {
- endpointElementMapper{}.linkerFor(e).SetNext(l.head)
- endpointElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := endpointElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
endpointElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *endpointList) PushFront(e *endpoint) {
// PushBack inserts the element e at the back of list l.
func (l *endpointList) PushBack(e *endpoint) {
- endpointElementMapper{}.linkerFor(e).SetNext(nil)
- endpointElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := endpointElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
endpointElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *endpointList) PushBackList(m *endpointList) {
// InsertAfter inserts e after b.
func (l *endpointList) InsertAfter(b, e *endpoint) {
- a := endpointElementMapper{}.linkerFor(b).Next()
- endpointElementMapper{}.linkerFor(e).SetNext(a)
- endpointElementMapper{}.linkerFor(e).SetPrev(b)
- endpointElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := endpointElementMapper{}.linkerFor(b)
+ eLinker := endpointElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
endpointElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *endpointList) InsertAfter(b, e *endpoint) {
// InsertBefore inserts e before a.
func (l *endpointList) InsertBefore(a, e *endpoint) {
- b := endpointElementMapper{}.linkerFor(a).Prev()
- endpointElementMapper{}.linkerFor(e).SetNext(a)
- endpointElementMapper{}.linkerFor(e).SetPrev(b)
- endpointElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := endpointElementMapper{}.linkerFor(a)
+ eLinker := endpointElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
endpointElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/tcp/tcp_segment_list.go b/pkg/tcpip/transport/tcp/tcp_segment_list.go
index 029f98a11..9b21b87ad 100755
--- a/pkg/tcpip/transport/tcp/tcp_segment_list.go
+++ b/pkg/tcpip/transport/tcp/tcp_segment_list.go
@@ -54,8 +54,9 @@ func (l *segmentList) Back() *segment {
// PushFront inserts the element e at the front of list l.
func (l *segmentList) PushFront(e *segment) {
- segmentElementMapper{}.linkerFor(e).SetNext(l.head)
- segmentElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := segmentElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
segmentElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *segmentList) PushFront(e *segment) {
// PushBack inserts the element e at the back of list l.
func (l *segmentList) PushBack(e *segment) {
- segmentElementMapper{}.linkerFor(e).SetNext(nil)
- segmentElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := segmentElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
segmentElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *segmentList) PushBackList(m *segmentList) {
// InsertAfter inserts e after b.
func (l *segmentList) InsertAfter(b, e *segment) {
- a := segmentElementMapper{}.linkerFor(b).Next()
- segmentElementMapper{}.linkerFor(e).SetNext(a)
- segmentElementMapper{}.linkerFor(e).SetPrev(b)
- segmentElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := segmentElementMapper{}.linkerFor(b)
+ eLinker := segmentElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
segmentElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *segmentList) InsertAfter(b, e *segment) {
// InsertBefore inserts e before a.
func (l *segmentList) InsertBefore(a, e *segment) {
- b := segmentElementMapper{}.linkerFor(a).Prev()
- segmentElementMapper{}.linkerFor(e).SetNext(a)
- segmentElementMapper{}.linkerFor(e).SetPrev(b)
- segmentElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := segmentElementMapper{}.linkerFor(a)
+ eLinker := segmentElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
segmentElementMapper{}.linkerFor(b).SetNext(e)
diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go
index 673a9373b..00535d242 100755
--- a/pkg/tcpip/transport/udp/udp_packet_list.go
+++ b/pkg/tcpip/transport/udp/udp_packet_list.go
@@ -54,8 +54,9 @@ func (l *udpPacketList) Back() *udpPacket {
// PushFront inserts the element e at the front of list l.
func (l *udpPacketList) PushFront(e *udpPacket) {
- udpPacketElementMapper{}.linkerFor(e).SetNext(l.head)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := udpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
udpPacketElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *udpPacketList) PushFront(e *udpPacket) {
// PushBack inserts the element e at the back of list l.
func (l *udpPacketList) PushBack(e *udpPacket) {
- udpPacketElementMapper{}.linkerFor(e).SetNext(nil)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := udpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
udpPacketElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *udpPacketList) PushBackList(m *udpPacketList) {
// InsertAfter inserts e after b.
func (l *udpPacketList) InsertAfter(b, e *udpPacket) {
- a := udpPacketElementMapper{}.linkerFor(b).Next()
- udpPacketElementMapper{}.linkerFor(e).SetNext(a)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- udpPacketElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := udpPacketElementMapper{}.linkerFor(b)
+ eLinker := udpPacketElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
udpPacketElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *udpPacketList) InsertAfter(b, e *udpPacket) {
// InsertBefore inserts e before a.
func (l *udpPacketList) InsertBefore(a, e *udpPacket) {
- b := udpPacketElementMapper{}.linkerFor(a).Prev()
- udpPacketElementMapper{}.linkerFor(e).SetNext(a)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- udpPacketElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := udpPacketElementMapper{}.linkerFor(a)
+ eLinker := udpPacketElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
udpPacketElementMapper{}.linkerFor(b).SetNext(e)