Cleanup: Don't call learnHash() in hashPicture()

hashPicture() calls hashFile(), which calls add_hash(). add_hash()
updates the filename-to-hash and hash-to-filename maps. Therefore,
there is no point in calling learnHash() in hashPicture(), which
updates the filename-to-hash map.

Note that learnHash() updates the picture-struct with the new hash,
but since hashPicture() works on a cloned picture-struct, which
is free()d in hashPicture(), these changes are lost anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-02-18 13:56:06 +01:00 committed by Lubomir I. Ivanov
parent a0d02bacf3
commit 83b2870648

View file

@ -1190,11 +1190,9 @@ void hashPicture(struct picture *picture)
{
if (!picture)
return;
char *oldHash = copy_string(picture->hash);
learnHash(picture, hashFile(localFilePath(picture->filename)));
if (!empty_string(picture->hash) && !same_string(picture->hash, oldHash))
QByteArray hash = hashFile(localFilePath(picture->filename));
if (!hash.isNull() && !same_string(hash.toHex().data(), picture->hash))
mark_divelist_changed(true);
free(oldHash);
picture_free(picture);
}