]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Remove ability to use multiple roots in setting_parser_context
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 8 Mar 2023 15:06:52 +0000 (17:06 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:20:55 +0000 (14:20 +0200)
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index 6d193d9499d4f40995686a06d66544115c38ee89..885497b6ddafc27068b45810d022175ac5db99b4 100644 (file)
@@ -74,13 +74,6 @@ settings_apply(struct setting_link *dest_link,
               const struct setting_link *src_link,
               pool_t pool, const char **conflict_key_r);
 
-struct setting_parser_context *
-settings_parser_init(pool_t set_pool, const struct setting_parser_info *root,
-                    enum settings_parser_flags flags)
-{
-        return settings_parser_init_list(set_pool, &root, 1, flags);
-}
-
 static void
 copy_unique_defaults(struct setting_parser_context *ctx,
                     const struct setting_define *def,
@@ -188,16 +181,13 @@ setting_parser_copy_defaults(struct setting_parser_context *ctx,
 }
 
 struct setting_parser_context *
-settings_parser_init_list(pool_t set_pool,
-                         const struct setting_parser_info *const *roots,
-                         unsigned int count, enum settings_parser_flags flags)
+settings_parser_init(pool_t set_pool, const struct setting_parser_info *root,
+                    enum settings_parser_flags flags)
 {
        struct setting_parser_context *ctx;
        unsigned int i;
        pool_t parser_pool;
 
-       i_assert(count > 0);
-
        parser_pool = pool_alloconly_create(MEMPOOL_GROWING"settings parser",
                                            1024);
        ctx = p_new(parser_pool, struct setting_parser_context, 1);
@@ -213,9 +203,10 @@ settings_parser_init_list(pool_t set_pool,
        hash_table_create(&ctx->links, ctx->parser_pool, 0,
                          strcase_hash, strcasecmp);
 
-       ctx->root_count = count;
-       ctx->roots = p_new(ctx->parser_pool, struct setting_link, count);
-       for (i = 0; i < count; i++) {
+       ctx->root_count = 1;
+       ctx->roots = p_new(ctx->parser_pool, struct setting_link, 1);
+       const struct setting_parser_info *const *roots = &root;
+       for (i = 0; i < 1; i++) {
                ctx->roots[i].info = roots[i];
                if (roots[i]->struct_size == 0)
                        continue;
@@ -271,18 +262,6 @@ void *settings_parser_get_changes(struct setting_parser_context *ctx)
        return ctx->roots[0].change_struct;
 }
 
-const struct setting_parser_info *const *
-settings_parser_get_roots(const struct setting_parser_context *ctx)
-{
-       const struct setting_parser_info **infos;
-       unsigned int i;
-
-       infos = t_new(const struct setting_parser_info *, ctx->root_count + 1);
-       for (i = 0; i < ctx->root_count; i++)
-               infos[i] = ctx->roots[i].info;
-       return infos;
-}
-
 static void settings_parser_set_error(struct setting_parser_context *ctx,
                                      const char *error)
 {
index 58071fcf1435d4eaf712766548fcf27bfcb2c6cf..d9729e459fe927b62a787998f6bb2167aca9b45b 100644 (file)
@@ -127,10 +127,6 @@ struct setting_parser_context;
 struct setting_parser_context *
 settings_parser_init(pool_t set_pool, const struct setting_parser_info *root,
                     enum settings_parser_flags flags);
-struct setting_parser_context *
-settings_parser_init_list(pool_t set_pool,
-                         const struct setting_parser_info *const *roots,
-                         unsigned int count, enum settings_parser_flags flags);
 void settings_parser_ref(struct setting_parser_context *ctx);
 void settings_parser_unref(struct setting_parser_context **ctx);
 
@@ -141,9 +137,6 @@ void *settings_parser_get_root_set(const struct setting_parser_context *ctx,
                                   const struct setting_parser_info *root);
 /* Return pointer to changes in the root setting structure. */
 void *settings_parser_get_changes(struct setting_parser_context *ctx);
-/* Returns the setting parser's roots (same as given to init()). */
-const struct setting_parser_info *const *
-settings_parser_get_roots(const struct setting_parser_context *ctx);
 
 /* Return the last error. */
 const char *settings_parser_get_error(struct setting_parser_context *ctx);