storage/State: use std::hash() instead of boost::crc
Also eliminate the useless std::set.
This commit is contained in:
parent
a5d04be21f
commit
2e453ef58a
@ -40,9 +40,7 @@
|
||||
#pragma GCC diagnostic ignored "-Wcomma"
|
||||
#endif
|
||||
|
||||
#include <boost/crc.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <functional> // for std::hash()
|
||||
|
||||
#define MOUNT_STATE_BEGIN "mount_begin"
|
||||
#define MOUNT_STATE_END "mount_end"
|
||||
@ -150,19 +148,16 @@ storage_state_get_hash(const Instance &instance) noexcept
|
||||
if (instance.storage == nullptr)
|
||||
return 0;
|
||||
|
||||
std::set<std::string> mounts;
|
||||
unsigned result = 0;
|
||||
|
||||
const auto visitor = [&mounts](const char *mount_uri, const Storage &storage) {
|
||||
mounts.emplace(std::string(mount_uri) + ":" + storage.MapUTF8(""));
|
||||
const std::hash<std::string_view> hash;
|
||||
|
||||
const auto visitor = [&result, &hash](const char *mount_uri, const Storage &storage) {
|
||||
result = result * 33 + hash(mount_uri);
|
||||
result = result * 33 + hash(storage.MapUTF8(""));
|
||||
};
|
||||
|
||||
((CompositeStorage*)instance.storage)->VisitMounts(visitor);
|
||||
|
||||
boost::crc_32_type result;
|
||||
|
||||
for (const auto& mount : mounts) {
|
||||
result.process_bytes(mount.c_str(), mount.length());
|
||||
}
|
||||
|
||||
return result.checksum();
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user