1
This commit is contained in:
parent
37aba94237
commit
a784d12ab4
16
listhead.go
16
listhead.go
@ -47,6 +47,9 @@ func (this *ListHead) AddHead(pnew *ListHead) {
|
||||
}
|
||||
|
||||
func (this *ListHead) FirstEntry() interface{} {
|
||||
if this.next.data != dummyData {
|
||||
return this.next.data
|
||||
}
|
||||
for pos := this.next; pos != this; pos = pos.next {
|
||||
if pos.data != dummyData {
|
||||
return pos.data
|
||||
@ -110,17 +113,18 @@ func (this *ListHead) ForEach(cb ListHead_Foreach_Func) {
|
||||
break
|
||||
}
|
||||
if cursor.next == oldN {
|
||||
cursor.next = oldN.next
|
||||
oldN.next.prev = &cursor
|
||||
oldN.prev = cursor.prev
|
||||
cursor.prev.next = oldN
|
||||
oldN.Del()
|
||||
|
||||
oldN.next = &cursor
|
||||
cursor.prev = oldN
|
||||
oldN.next.prev = oldN
|
||||
|
||||
oldN.prev = cursor.prev
|
||||
oldN.prev.next = oldN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewListHead () *ListHead{
|
||||
func NewListHead () *ListHead {
|
||||
l := new(ListHead)
|
||||
l.Init(nil)
|
||||
return l
|
||||
|
Loading…
x
Reference in New Issue
Block a user