aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/db.go b/db.go
index d15dc74..2fc9065 100644
--- a/db.go
+++ b/db.go
@@ -575,19 +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 Stats
- if s == nil {
- if other == nil {
- return diff
- } else {
- return *other
- }
- }
- 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
}