mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 11:44:45 -06:00
Remove a few util functions that aren't necessary
This commit is contained in:
@@ -139,13 +139,15 @@ func ProcessFilters() (patterns []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ProcessFilterFile(patternFile string, includedFiles []string) (patterns []string) {
|
func ProcessFilterFile(patternFile string, includedFiles []string) (patterns []string) {
|
||||||
if Contains(includedFiles, patternFile) {
|
for _, file := range includedFiles {
|
||||||
// cycle in include mechanism discovered.
|
if file == patternFile {
|
||||||
LOG_WARN("SNAPSHOT_FILTER", "Cycle in filter includes: %s", strings.Join(includedFiles, " => "))
|
// cycle in include mechanism discovered.
|
||||||
return patterns
|
LOG_ERROR("SNAPSHOT_FILTER", "The filter file %s has already been included", patternFile)
|
||||||
|
return patterns
|
||||||
|
}
|
||||||
}
|
}
|
||||||
includedFiles = append(includedFiles, patternFile)
|
includedFiles = append(includedFiles, patternFile)
|
||||||
LOG_INFO("SNAPSHOT_FILTER", "Parsing filter file %s ...", patternFile)
|
LOG_INFO("SNAPSHOT_FILTER", "Parsing filter file %s", patternFile)
|
||||||
patternFileContent, err := ioutil.ReadFile(patternFile)
|
patternFileContent, err := ioutil.ReadFile(patternFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
patternFileLines := strings.Split(string(patternFileContent), "\n")
|
patternFileLines := strings.Split(string(patternFileContent), "\n")
|
||||||
|
|||||||
@@ -1016,7 +1016,9 @@ func (manager *SnapshotManager) ShowStatisticsTabular(snapshotMap map[string][]*
|
|||||||
if earliestSeenChunks[chunkID] == 0 {
|
if earliestSeenChunks[chunkID] == 0 {
|
||||||
earliestSeenChunks[chunkID] = math.MaxInt32
|
earliestSeenChunks[chunkID] = math.MaxInt32
|
||||||
}
|
}
|
||||||
earliestSeenChunks[chunkID] = MinInt(earliestSeenChunks[chunkID], snapshot.Revision)
|
if earliestSeenChunks[chunkID] > snapshot.Revision {
|
||||||
|
earliestSeenChunks[chunkID] = snapshot.Revision
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -460,31 +460,3 @@ func AtoSize(sizeString string) int {
|
|||||||
|
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func MinInt(x, y int) int {
|
|
||||||
if x < y {
|
|
||||||
return x
|
|
||||||
}
|
|
||||||
return y
|
|
||||||
}
|
|
||||||
|
|
||||||
// Contains tells whether a contains x.
|
|
||||||
func Contains(a []string, x string) bool {
|
|
||||||
for _, n := range a {
|
|
||||||
if x == n {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find returns the smallest index i at which x == a[i],
|
|
||||||
// or len(a) if there is no such index.
|
|
||||||
func Find(a []string, x string) int {
|
|
||||||
for i, n := range a {
|
|
||||||
if x == n {
|
|
||||||
return i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len(a)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user