mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-02 10:01:57 +00:00
ipn: use *Prefs rather than Prefs throughout.
Prefs has become a heavy object with non-memcpy copy semantics. We should not pass such a thing by value. Signed-off-by: David Anderson <dave@natulte.net>
This commit is contained in:
committed by
Dave Anderson
parent
0c55777fed
commit
c47f907a27
@@ -180,8 +180,8 @@ func TestPrefsEqual(t *testing.T) {
|
||||
|
||||
func checkPrefs(t *testing.T, p Prefs) {
|
||||
var err error
|
||||
var p2, p2c Prefs
|
||||
var p2b Prefs
|
||||
var p2, p2c *Prefs
|
||||
var p2b *Prefs
|
||||
|
||||
pp := p.Pretty()
|
||||
if pp == "" {
|
||||
@@ -195,9 +195,9 @@ func checkPrefs(t *testing.T, p Prefs) {
|
||||
if !p.Equals(&p) {
|
||||
t.Fatalf("p != p\n")
|
||||
}
|
||||
p2 = p
|
||||
p2 = p.Copy()
|
||||
p2.RouteAll = true
|
||||
if p.Equals(&p2) {
|
||||
if p.Equals(p2) {
|
||||
t.Fatalf("p == p2\n")
|
||||
}
|
||||
p2b, err = PrefsFromBytes(p2.ToBytes(), false)
|
||||
@@ -210,11 +210,11 @@ func checkPrefs(t *testing.T, p Prefs) {
|
||||
if p2p != p2bp {
|
||||
t.Fatalf("p2p != p2bp\n%#v\n%#v\n", p2p, p2bp)
|
||||
}
|
||||
if !p2.Equals(&p2b) {
|
||||
if !p2.Equals(p2b) {
|
||||
t.Fatalf("p2 != p2b\n%#v\n%#v\n", p2, p2b)
|
||||
}
|
||||
p2c = *p2.Copy()
|
||||
if !p2b.Equals(&p2c) {
|
||||
p2c = p2.Copy()
|
||||
if !p2b.Equals(p2c) {
|
||||
t.Fatalf("p2b != p2c\n")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user