From f1fe64b9ccce27591f2d3027a001040a78272dc6 Mon Sep 17 00:00:00 2001 From: Arno Hautala Date: Tue, 19 Sep 2017 01:06:08 -0400 Subject: [PATCH] moving "func min" to MinInt in utils --- src/duplicacy_snapshotmanager.go | 10 +--------- src/duplicacy_utils.go | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/duplicacy_snapshotmanager.go b/src/duplicacy_snapshotmanager.go index 5434faa..9f3137f 100644 --- a/src/duplicacy_snapshotmanager.go +++ b/src/duplicacy_snapshotmanager.go @@ -913,7 +913,7 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe if earliestSeenChunks[chunkID] == 0 { earliestSeenChunks[chunkID] = math.MaxInt64 } - earliestSeenChunks[chunkID] = min(earliestSeenChunks[chunkID], snapshot.Revision) + earliestSeenChunks[chunkID] = MinInt(earliestSeenChunks[chunkID], snapshot.Revision) } } @@ -982,14 +982,6 @@ func (manager *SnapshotManager) CheckSnapshots(snapshotID string, revisionsToChe } -func min(x, y int) int { - if x < y { - return x - } - return y -} - - // ConvertSequence converts a sequence of chunk hashes into a sequence of chunk ids. func (manager *SnapshotManager) ConvertSequence(sequence []string) (result []string) { result = make([]string, len(sequence)) diff --git a/src/duplicacy_utils.go b/src/duplicacy_utils.go index 5c9187d..e3f5222 100644 --- a/src/duplicacy_utils.go +++ b/src/duplicacy_utils.go @@ -427,3 +427,10 @@ func AtoSize(sizeString string) (int) { return size } + +func MinInt(x, y int) (int) { + if x < y { + return x + } + return y +}