diff options
| author | Joe <rbo@gmx.us> | 2023-12-20 20:20:20 +0100 | 
|---|---|---|
| committer | Joe <rbo@gmx.us> | 2023-12-20 20:20:20 +0100 | 
| commit | 2e54711df0a7d064fd45fe1e10a5b8675b2ed459 (patch) | |
| tree | fccb2fd1fd9857515a8ff35da6d3bf2d60d7962a /c_lhosts.go | |
| parent | fix (diff) | |
| download | hardflip-2e54711df0a7d064fd45fe1e10a5b8675b2ed459.tar.gz hardflip-2e54711df0a7d064fd45fe1e10a5b8675b2ed459.tar.bz2 hardflip-2e54711df0a7d064fd45fe1e10a5b8675b2ed459.tar.xz hardflip-2e54711df0a7d064fd45fe1e10a5b8675b2ed459.tar.zst hardflip-2e54711df0a7d064fd45fe1e10a5b8675b2ed459.zip  | |
delete
Diffstat (limited to 'c_lhosts.go')
| -rw-r--r-- | c_lhosts.go | 39 | 
1 files changed, 19 insertions, 20 deletions
diff --git a/c_lhosts.go b/c_lhosts.go index 8cfeb37..ac5cfcd 100644 --- a/c_lhosts.go +++ b/c_lhosts.go @@ -94,23 +94,23 @@ func (lhost *HostList) add_back(node *HostNode) {  	curr.next = new_node  } -// removes a host node from the list -func (lhost *HostList) del(id uint64) { -	if lhost.head == nil { -		return -	} -	if lhost.head.ID == id { -		lhost.head = lhost.head.next -		return -	} -	curr := lhost.head -	for curr.next != nil && curr.next.ID != id { -		curr = curr.next -	} -	if curr.next != nil { -		curr.next = curr.next.next -	} -} +// not used - removes a host node from the list +// func (lhost *HostList) del(id uint64) { +//     if lhost.head == nil { +//         return +//     } +//     if lhost.head.ID == id { +//         lhost.head = lhost.head.next +//         return +//     } +//     curr := lhost.head +//     for curr.next != nil && curr.next.ID != id { +//         curr = curr.next +//     } +//     if curr.next != nil { +//         curr.next = curr.next.next +//     } +// }  // return the list node with the according id  func (lhost *HostList) sel(id uint64) *HostNode { @@ -127,11 +127,10 @@ func (lhost *HostList) sel(id uint64) *HostNode {  func (lhost *HostList) count() uint64 {  	curr := lhost.head -	var count uint64 = 0 +	var count uint64 -	for curr != nil { +	for count = 0; curr != nil; count++ {  		curr = curr.next -		count++  	}  	return count  }  | 
