]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Add setting_parser_info_get_define_count()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 30 May 2023 15:14:02 +0000 (18:14 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:08 +0000 (12:34 +0200)
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h

index e3d08ab969ed191d2b7dee9bf79e51948cdd6f67..e1a14f6d0d232b97baa6df84ad71259d59eb9ca7 100644 (file)
@@ -147,6 +147,15 @@ void settings_parser_unref(struct setting_parser_context **_ctx)
        pool_unref(&ctx->parser_pool);
 }
 
+unsigned int
+setting_parser_info_get_define_count(const struct setting_parser_info *info)
+{
+       unsigned int count = 0;
+       while (info->defines[count].key != NULL)
+               count++;
+       return count;
+}
+
 void *settings_parser_get_set(const struct setting_parser_context *ctx)
 {
        return ctx->set_struct;
index 2372f90cf851c8cab846c208692e02197cd85564..2681ea2a6435aa86deb691aa71a8e7bf4b6c7c13 100644 (file)
@@ -141,6 +141,10 @@ settings_parser_init(pool_t set_pool, const struct setting_parser_info *root,
 void settings_parser_ref(struct setting_parser_context *ctx);
 void settings_parser_unref(struct setting_parser_context **ctx);
 
+/* Returns number of defines in info->defines */
+unsigned int
+setting_parser_info_get_define_count(const struct setting_parser_info *info);
+
 /* Returns the current settings. */
 void *settings_parser_get_set(const struct setting_parser_context *ctx);
 /* Return pointer to changes in the root setting structure. */