From ba79a0a355f2511adbc2c7356a3362da180548c8 Mon Sep 17 00:00:00 2001 From: Martin Kobetic Date: Tue, 24 Jun 2014 17:39:48 +0000 Subject: drop the *s guard --- db.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'db.go') diff --git a/db.go b/db.go index d15dc74..6b43f43 100644 --- a/db.go +++ b/db.go @@ -575,15 +575,7 @@ type Stats struct { // This is useful when obtaining stats at two different points and time and // you need the performance counters that occurred within that time span. func (s *Stats) Sub(other *Stats) Stats { - var diff Stats - if s == nil { - if other == nil { - return diff - } else { - return *other - } - } - diff = *s + var diff = *s if other == nil { return diff } -- cgit v1.2.3 From bae0fbd29027eb56cb70067098041cf31483fca8 Mon Sep 17 00:00:00 2001 From: Martin Kobetic Date: Tue, 24 Jun 2014 17:54:40 +0000 Subject: review tweaks --- db.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'db.go') diff --git a/db.go b/db.go index 6b43f43..2fc9065 100644 --- a/db.go +++ b/db.go @@ -575,11 +575,11 @@ type Stats struct { // This is useful when obtaining stats at two different points and time and // you need the performance counters that occurred within that time span. func (s *Stats) Sub(other *Stats) Stats { - var diff = *s if other == nil { - return diff + return *s } - diff.TxN = other.TxN - diff.TxN + var diff Stat + diff.TxN = other.TxN - s.TxN diff.TxStats = s.TxStats.Sub(&other.TxStats) return diff } -- cgit v1.2.3