refactor: return slice instead of pointer to slice from tombstone()

This commit is contained in:
Matthias Radestock committed 2015-07-20 12:37:54 +01:00
1 parent a9229b9197
commit 66473e6021
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -131,7 +131,7 @@ func (es *Entries) merge(incoming Entries) Entries {
return newEntries return newEntries
} }
func (es *Entries) tombstone(ourname router.PeerName, f func(*Entry) bool) *Entries { func (es *Entries) tombstone(ourname router.PeerName, f func(*Entry) bool) Entries {
es.checkAndPanic() es.checkAndPanic()
defer es.checkAndPanic() defer es.checkAndPanic()
tombstoned := Entries{} tombstoned := Entries{}
@@ -143,7 +143,7 @@ func (es *Entries) tombstone(ourname router.PeerName, f func(*Entry) bool) *Entr
tombstoned = append(tombstoned, e) tombstoned = append(tombstoned, e)
} }
} }
return &tombstoned return tombstoned
} }
func (es *Entries) filter(f func(*Entry) bool) { func (es *Entries) filter(f func(*Entry) bool) {
+3 -3
View File
@@ -130,8 +130,8 @@ func (n *Nameserver) ContainerDied(ident string) {
return false return false
}) })
n.Unlock() n.Unlock()
if n.gossip != nil && len(*entries) > 0 { if n.gossip != nil && len(entries) > 0 {
err := n.gossip.GossipBroadcast(entries) err := n.gossip.GossipBroadcast(&entries)
if err != nil { if err != nil {
n.errorf("Failed to broadcast container '%s' death: %v", ident, err) n.errorf("Failed to broadcast container '%s' death: %v", ident, err)
} }
@@ -166,7 +166,7 @@ func (n *Nameserver) Delete(hostname, containerid, ipStr string, ip address.Addr
}) })
n.Unlock() n.Unlock()
if n.gossip != nil { if n.gossip != nil {
return n.gossip.GossipBroadcast(entries) return n.gossip.GossipBroadcast(&entries)
} }
return nil return nil
} }