diff --git a/src/lib-sieve/sieve-storage-private.h b/src/lib-sieve/sieve-storage-private.h index 64bb8f138386938547c1af6c45ad5c591dc746db..6b1a45796e6c0a9e7f5964dec4757915534d4205 100644 --- a/src/lib-sieve/sieve-storage-private.h +++ b/src/lib-sieve/sieve-storage-private.h @@ -132,6 +132,7 @@ int sieve_storage_setup_bin_path(struct sieve_storage *storage, mode_t mode); int sieve_storage_cmp(const struct sieve_storage *storage1, const struct sieve_storage *storage2); +unsigned int sieve_storage_hash(const struct sieve_storage *storage); /* * Active script diff --git a/src/lib-sieve/sieve-storage.c b/src/lib-sieve/sieve-storage.c index 5a8155a69bf35342c15f86b3e3860d73ce79d048..ea921ccf93cbcf495cddf3e0b1fcada1931a8354 100644 --- a/src/lib-sieve/sieve-storage.c +++ b/src/lib-sieve/sieve-storage.c @@ -4,6 +4,7 @@ #include "lib.h" #include "array.h" #include "str-sanitize.h" +#include "hash.h" #include "home-expand.h" #include "eacces-error.h" #include "mkdir-parents.h" @@ -854,6 +855,16 @@ int sieve_storage_cmp(const struct sieve_storage *storage1, return null_strcmp(storage1->location, storage2->location); } +unsigned int sieve_storage_hash(const struct sieve_storage *storage) +{ + unsigned int hash = 0; + + hash ^= POINTER_CAST_TO(storage->storage_class, unsigned int); + hash ^= str_hash(storage->location); + + return hash; +} + /* * Script access */