diff --git a/src/lib-sieve/sieve-extensions.c b/src/lib-sieve/sieve-extensions.c index 58518f4f9238399ccdd16caa5a811387fcad6422..7aee135a8ef19b6e5e36190aef9c7aa0d9be9541 100644 --- a/src/lib-sieve/sieve-extensions.c +++ b/src/lib-sieve/sieve-extensions.c @@ -296,7 +296,7 @@ sieve_extensions_get_preloaded(struct sieve_instance *svinst, * Extension registry */ -static bool _sieve_extension_load(struct sieve_extension *ext) +static int _sieve_extension_load(struct sieve_extension *ext) { /* Call load handler */ if (ext->def != NULL && ext->def->load != NULL && @@ -304,9 +304,9 @@ static bool _sieve_extension_load(struct sieve_extension *ext) e_error(ext->svinst->event, "failed to load '%s' extension support.", ext->def->name); - return FALSE; + return -1; } - return TRUE; + return 0; } static void _sieve_extension_unload(struct sieve_extension *ext) @@ -403,7 +403,7 @@ _sieve_extension_register(struct sieve_instance *svinst, /* Call load handler if extension was not loaded already */ if (!ext->loaded) { - if (!_sieve_extension_load(ext)) + if (_sieve_extension_load(ext) < 0) return -1; } ext->loaded = TRUE; @@ -471,19 +471,18 @@ int sieve_extension_require(struct sieve_instance *svinst, ext_r); } -bool sieve_extension_reload(const struct sieve_extension *ext) +int sieve_extension_reload(const struct sieve_extension *ext) { struct sieve_extension_registry *ext_reg = ext->svinst->ext_reg; struct sieve_extension *const *mod_ext; int ext_id = ext->id; /* Let's not just cast the 'const' away */ - if (ext_id >= 0 && ext_id < (int) array_count(&ext_reg->extensions)) { - mod_ext = array_idx(&ext_reg->extensions, ext_id); + i_assert(ext_id >= 0 && + ext_id < (int) array_count(&ext_reg->extensions)); - return _sieve_extension_load(*mod_ext); - } - return FALSE; + mod_ext = array_idx(&ext_reg->extensions, ext_id); + return _sieve_extension_load(*mod_ext); } const struct sieve_extension * diff --git a/src/lib-sieve/sieve-extensions.h b/src/lib-sieve/sieve-extensions.h index 7546b63523a22d4089f51d5271633fa760e2c557..c63d3f87eb354b0070fd38195616b2f59f73d5e1 100644 --- a/src/lib-sieve/sieve-extensions.h +++ b/src/lib-sieve/sieve-extensions.h @@ -133,7 +133,7 @@ int sieve_extension_register(struct sieve_instance *svinst, int sieve_extension_require(struct sieve_instance *svinst, const struct sieve_extension_def *extdef, bool load, const struct sieve_extension **ext_r); -bool sieve_extension_reload(const struct sieve_extension *ext); +int sieve_extension_reload(const struct sieve_extension *ext); void sieve_extension_unregister(const struct sieve_extension *ext);