crypt: use an in place filter for encrypting directory entries

This commit is contained in:
Nick Craig-Wood 2017-06-15 16:45:21 +01:00
parent 5250fcdf08
commit e069fc439e

View File

@ -170,9 +170,9 @@ func (f *Fs) addDir(entries *fs.DirEntries, dir *fs.Dir) {
*entries = append(*entries, f.newDir(dir))
}
// Encrypt some directory entries
// Encrypt some directory entries. This alters entries returning it as newEntries.
func (f *Fs) encryptEntries(entries fs.DirEntries) (newEntries fs.DirEntries, err error) {
newEntries = make(fs.DirEntries, 0, len(entries))
newEntries = entries[:0] // in place filter
for _, entry := range entries {
switch x := entry.(type) {
case fs.Object: