Skip to content

Commit

Permalink
Shorten copy
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed May 24, 2016
1 parent 3614306 commit 40a76c5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions filebeat/input/state.go
Expand Up @@ -106,17 +106,13 @@ func (s *States) Count() int {

// Returns a copy of the file states
func (s *States) GetStates() []FileState {

s.mutex.Lock()
defer s.mutex.Unlock()

copy := make([]FileState, len(s.states))

for i := range s.states {
copy[i] = s.states[i]
}
newStates := make([]FileState, len(s.states))
copy(newStates, s.states)

return copy
return newStates
}

// SetStates overwrites all internal states with the given states array
Expand Down

0 comments on commit 40a76c5

Please sign in to comment.