lib/db: Constant/unused args and return values, double it.Release (#8259)
This commit is contained in:
+8
-10
@@ -262,11 +262,9 @@ func (vl *VersionList) update(folder, device []byte, file protocol.FileIntf, t r
|
||||
oldFV = oldFV.copy()
|
||||
|
||||
// Remove ourselves first
|
||||
removedFV, haveRemoved, _, err := vl.pop(device, []byte(file.FileName()))
|
||||
if err == nil {
|
||||
// Find position and insert the file
|
||||
err = vl.insert(folder, device, file, t)
|
||||
}
|
||||
removedFV, haveRemoved, _ := vl.pop(device)
|
||||
// Find position and insert the file
|
||||
err := vl.insert(folder, device, file, t)
|
||||
if err != nil {
|
||||
return FileVersion{}, FileVersion{}, FileVersion{}, false, false, false, err
|
||||
}
|
||||
@@ -315,28 +313,28 @@ func (vl *VersionList) insertAt(i int, v FileVersion) {
|
||||
// pop removes the given device from the VersionList and returns the FileVersion
|
||||
// before removing the device, whether it was found/removed at all and whether
|
||||
// the global changed in the process.
|
||||
func (vl *VersionList) pop(device, name []byte) (FileVersion, bool, bool, error) {
|
||||
func (vl *VersionList) pop(device []byte) (FileVersion, bool, bool) {
|
||||
invDevice, i, j, ok := vl.findDevice(device)
|
||||
if !ok {
|
||||
return FileVersion{}, false, false, nil
|
||||
return FileVersion{}, false, false
|
||||
}
|
||||
globalPos := vl.findGlobal()
|
||||
|
||||
if vl.RawVersions[i].deviceCount() == 1 {
|
||||
fv := vl.RawVersions[i]
|
||||
vl.popVersionAt(i)
|
||||
return fv, true, globalPos == i, nil
|
||||
return fv, true, globalPos == i
|
||||
}
|
||||
|
||||
oldFV := vl.RawVersions[i].copy()
|
||||
if invDevice {
|
||||
vl.RawVersions[i].InvalidDevices = popDeviceAt(vl.RawVersions[i].InvalidDevices, j)
|
||||
return oldFV, true, false, nil
|
||||
return oldFV, true, false
|
||||
}
|
||||
vl.RawVersions[i].Devices = popDeviceAt(vl.RawVersions[i].Devices, j)
|
||||
// If the last valid device of the previous global was removed above,
|
||||
// the global changed.
|
||||
return oldFV, true, len(vl.RawVersions[i].Devices) == 0 && globalPos == i, nil
|
||||
return oldFV, true, len(vl.RawVersions[i].Devices) == 0 && globalPos == i
|
||||
}
|
||||
|
||||
// Get returns a FileVersion that contains the given device and whether it has
|
||||
|
||||
Reference in New Issue
Block a user