]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict: Add dict_init_filter_auto()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 21 Mar 2024 22:25:18 +0000 (00:25 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
src/lib-dict/dict.c
src/lib-dict/dict.h

index 5c8c75ccab355b52480feedeeb6f390a33674c10..c23644d57ab6cf71bc77f55215b1edf709009928 100644 (file)
@@ -181,9 +181,7 @@ static bool dict_settings_check(void *_set, pool_t pool ATTR_UNUSED,
 int dict_init_auto(struct event *event, struct dict **dict_r,
                   const char **error_r)
 {
-       const struct dict *dict_driver;
        struct dict_settings *dict_set;
-       const char *error;
 
        i_assert(event != NULL);
 
@@ -209,10 +207,21 @@ int dict_init_auto(struct event *event, struct dict **dict_r,
                return -1;
        }
 
+       int ret = dict_init_filter_auto(event, dict_name_first, dict_r, error_r);
+       settings_free(dict_set);
+       return ret;
+}
+
+int dict_init_filter_auto(struct event *event, const char *dict_name,
+                         struct dict **dict_r, const char **error_r)
+{
+       struct dict_settings *dict_set;
+       const struct dict *dict_driver;
+       const char *error;
+
        /* Get settings for the first dict list filter */
        event = event_create(event);
-       event_add_str(event, "dict", dict_name_first);
-       settings_free(dict_set);
+       event_add_str(event, "dict", dict_name);
        if (settings_get(event, &dict_setting_parser_info, 0,
                         &dict_set, error_r) < 0) {
                event_unref(&event);
index 6e57aed7b484bc4093280db1557bc293bbfa988b..53a89f2f52f0d735a8fb812ac89a55eb1ae014c8 100644 (file)
@@ -115,6 +115,10 @@ int dict_init_legacy(const char *uri, const struct dict_legacy_settings *set,
    driver initialization failed. */
 int dict_init_auto(struct event *event, struct dict **dict_r,
                   const char **error_r);
+/* Initialize a specific named dict. This is intended to be used only by the
+   dict server. */
+int dict_init_filter_auto(struct event *event, const char *dict_name,
+                         struct dict **dict_r, const char **error_r);
 /* Close dictionary. */
 void dict_deinit(struct dict **dict);
 /* Wait for all pending asynchronous operations to finish. */