dovecot-2.0: struct setting_parser_info now specifies the module...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Oct 21 00:36:13 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/dcda7c495eb6
changeset: 10107:dcda7c495eb6
user: Timo Sirainen <tss at iki.fi>
date: Tue Oct 20 17:36:06 2009 -0400
description:
struct setting_parser_info now specifies the module name.
diffstat:
23 files changed, 58 insertions(+), 41 deletions(-)
src/auth/auth-settings.c | 3 +++
src/config/all-settings.h | 6 +-----
src/config/config-filter.c | 6 +++---
src/config/config-parser.c | 20 +++++++++-----------
src/config/config-parser.h | 3 +--
src/config/config-request.c | 17 +++++++++--------
src/config/doveconf.c | 4 ++--
src/config/settings-get.pl | 20 ++++++++++----------
src/dict/dict-settings.c | 1 +
src/imap/imap-settings.c | 1 +
src/lib-lda/lda-settings.c | 1 +
src/lib-master/master-service-settings.c | 1 +
src/lib-settings/settings-parser.c | 1 +
src/lib-settings/settings-parser.h | 1 +
src/lib-storage/index/dbox-multi/mdbox-settings.c | 1 +
src/lib-storage/index/maildir/maildir-settings.c | 1 +
src/lib-storage/index/mbox/mbox-settings.c | 1 +
src/lib-storage/mail-storage-settings.c | 3 +++
src/lmtp/lmtp-settings.c | 1 +
src/login-common/login-settings.c | 1 +
src/master/master-settings.c | 4 ++++
src/pop3/pop3-settings.c | 1 +
src/ssl-params/ssl-params-settings.c | 1 +
diffs (truncated from 467 to 300 lines):
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/auth/auth-settings.c
--- a/src/auth/auth-settings.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/auth/auth-settings.c Tue Oct 20 17:36:06 2009 -0400
@@ -26,6 +26,7 @@ static struct setting_define auth_passdb
};
struct setting_parser_info auth_passdb_setting_parser_info = {
+ MEMBER(module_name) NULL,
MEMBER(defines) auth_passdb_setting_defines,
MEMBER(defaults) NULL,
@@ -48,6 +49,7 @@ static struct setting_define auth_userdb
};
struct setting_parser_info auth_userdb_setting_parser_info = {
+ MEMBER(module_name) NULL,
MEMBER(defines) auth_userdb_setting_defines,
MEMBER(defaults) NULL,
@@ -129,6 +131,7 @@ static struct auth_settings auth_default
};
struct setting_parser_info auth_setting_parser_info = {
+ MEMBER(module_name) "auth",
MEMBER(defines) auth_setting_defines,
MEMBER(defaults) &auth_default_settings,
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/all-settings.h
--- a/src/config/all-settings.h Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/all-settings.h Tue Oct 20 17:36:06 2009 -0400
@@ -1,10 +1,6 @@
#ifndef ALL_SETTINGS_H
#define ALL_SETTINGS_H
-struct all_settings_root {
- const char *module_name;
- struct setting_parser_info *root;
-};
-extern const struct all_settings_root all_roots[];
+extern const struct setting_parser_info *all_roots[];
#endif
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/config-filter.c
--- a/src/config/config-filter.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/config-filter.c Tue Oct 20 17:36:06 2009 -0400
@@ -148,7 +148,7 @@ config_module_parser_apply_changes(struc
{
unsigned int i;
- for (i = 0; dest[i].module_name != NULL; i++) {
+ for (i = 0; dest[i].root != NULL; i++) {
if (settings_parser_apply_changes(dest[i].parser,
src->parsers[i].parser, pool,
error_r) < 0) {
@@ -175,7 +175,7 @@ int config_filter_parsers_get(struct con
/* all of them should have the same number of parsers.
duplicate our initial parsers from the first match */
- for (count = 0; src[0]->parsers[count].module_name != NULL; count++) ;
+ for (count = 0; src[0]->parsers[count].root != NULL; count++) ;
dest = p_new(pool, struct config_module_parser, count + 1);
for (i = 0; i < count; i++) {
dest[i] = src[0]->parsers[i];
@@ -206,6 +206,6 @@ void config_filter_parsers_free(struct c
{
unsigned int i;
- for (i = 0; parsers[i].module_name != NULL; i++)
+ for (i = 0; parsers[i].root != NULL; i++)
settings_parser_deinit(&parsers[i].parser);
}
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/config-parser.c
--- a/src/config/config-parser.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/config-parser.c Tue Oct 20 17:36:06 2009 -0400
@@ -27,7 +27,7 @@ struct config_section_stack {
struct config_section_stack *prev;
struct config_filter filter;
- /* module_name=NULL-terminated list of parsers */
+ /* root=NULL-terminated list of parsers */
struct config_module_parser *parsers;
unsigned int pathlen;
};
@@ -106,7 +106,7 @@ config_apply_line(struct parser_context
bool found = FALSE;
int ret;
- for (l = ctx->cur_section->parsers; l->module_name != NULL; l++) {
+ for (l = ctx->cur_section->parsers; l->root != NULL; l++) {
ret = settings_parse_line(l->parser, line);
if (ret > 0) {
found = TRUE;
@@ -146,13 +146,12 @@ config_module_parsers_init(pool_t pool)
struct config_module_parser *dest;
unsigned int i, count;
- for (count = 0; all_roots[count].module_name != NULL; count++) ;
+ for (count = 0; all_roots[count] != NULL; count++) ;
dest = p_new(pool, struct config_module_parser, count + 1);
for (i = 0; i < count; i++) {
- dest[i].module_name = all_roots[i].module_name;
- dest[i].root = all_roots[i].root;
- dest[i].parser = settings_parser_init(pool, all_roots[i].root,
+ dest[i].root = all_roots[i];
+ dest[i].parser = settings_parser_init(pool, all_roots[i],
settings_parser_flags);
}
return dest;
@@ -266,7 +265,7 @@ config_filter_parser_check(struct parser
const struct config_module_parser *p,
const char **error_r)
{
- for (; p->module_name != NULL; p++) {
+ for (; p->root != NULL; p++) {
settings_parse_var_skip(p->parser);
if (!settings_parser_check(p->parser, ctx->pool, error_r))
return -1;
@@ -589,14 +588,13 @@ int config_parse_file(const char *path,
ctx.pool = pool_alloconly_create("config file parser", 1024*64);
ctx.path = path;
- for (count = 0; all_roots[count].module_name != NULL; count++) ;
+ for (count = 0; all_roots[count] != NULL; count++) ;
ctx.root_parsers =
p_new(ctx.pool, struct config_module_parser, count+1);
for (i = 0; i < count; i++) {
- ctx.root_parsers[i].module_name = all_roots[i].module_name;
- ctx.root_parsers[i].root = all_roots[i].root;
+ ctx.root_parsers[i].root = all_roots[i];
ctx.root_parsers[i].parser =
- settings_parser_init(ctx.pool, all_roots[i].root,
+ settings_parser_init(ctx.pool, all_roots[i],
settings_parser_flags);
}
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/config-parser.h
--- a/src/config/config-parser.h Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/config-parser.h Tue Oct 20 17:36:06 2009 -0400
@@ -2,8 +2,7 @@
#define CONFIG_PARSER_H
struct config_module_parser {
- const char *module_name;
- struct setting_parser_info *root;
+ const struct setting_parser_info *root;
struct setting_parser_context *parser;
void *settings;
};
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/config-request.c
--- a/src/config/config-request.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/config-request.c Tue Oct 20 17:36:06 2009 -0400
@@ -22,10 +22,11 @@ struct settings_export_context {
void *context;
};
-static bool parsers_are_connected(struct setting_parser_info *root,
- struct setting_parser_info *info)
-{
- struct setting_parser_info *const *dep, *p;
+static bool parsers_are_connected(const struct setting_parser_info *root,
+ const struct setting_parser_info *info)
+{
+ const struct setting_parser_info *p;
+ struct setting_parser_info *const *dep;
/* we're trying to find info or its parents from root's dependencies. */
@@ -51,15 +52,15 @@ config_module_parser_is_in_service(const
{
struct config_module_parser *l;
- if (strcmp(list->module_name, module) == 0)
+ if (strcmp(list->root->module_name, module) == 0)
return TRUE;
if (list->root == &master_service_setting_parser_info) {
/* everyone wants master service settings */
return TRUE;
}
- for (l = config_module_parsers; l->module_name != NULL; l++) {
- if (strcmp(l->module_name, module) != 0)
+ for (l = config_module_parsers; l->root != NULL; l++) {
+ if (strcmp(l->root->module_name, module) != 0)
continue;
/* see if we can find a way to get from the original parser
@@ -260,7 +261,7 @@ int config_request_handle(const struct c
ctx.keys = hash_table_create(default_pool, ctx.pool, 0,
str_hash, (hash_cmp_callback_t *)strcmp);
- for (i = 0; parsers[i].module_name != NULL; i++) {
+ for (i = 0; parsers[i].root != NULL; i++) {
parser = &parsers[i];
if (*module != '\0' &&
!config_module_parser_is_in_service(parser, module))
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/doveconf.c
--- a/src/config/doveconf.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/doveconf.c Tue Oct 20 17:36:06 2009 -0400
@@ -188,8 +188,8 @@ static const char *get_mail_location(voi
const char *const *value;
const void *set;
- for (l = config_module_parsers; l->module_name != NULL; l++) {
- if (strcmp(l->module_name, "mail") != 0)
+ for (l = config_module_parsers; l->root != NULL; l++) {
+ if (strcmp(l->root->module_name, "mail") != 0)
continue;
set = settings_parser_get(l->parser);
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/config/settings-get.pl
--- a/src/config/settings-get.pl Tue Oct 20 17:15:01 2009 -0400
+++ b/src/config/settings-get.pl Tue Oct 20 17:36:06 2009 -0400
@@ -22,6 +22,7 @@ foreach my $file (@ARGV) {
my $externs = "";
my $code = "";
my %funcs;
+ my $cur_name = "";
while (<$f>) {
my $write = 0;
@@ -32,8 +33,7 @@ foreach my $file (@ARGV) {
$state++;
} elsif (/^(static )?struct setting_parser_info (.*) = {/) {
$state++;
- my $name = $2;
- $parsers{$name} = 1 if ($name !~ /\*/);
+ $cur_name = $2;
} elsif (/^extern struct setting_parser_info (.*);/) {
$externs .= "extern struct setting_parser_info $1;\n";
} elsif (/\/\* <settings checks> \*\//) {
@@ -55,6 +55,9 @@ foreach my $file (@ARGV) {
if ($state == 1 || $state == 3) {
if ($state == 1) {
+ if (/MEMBER\(module_name\) "(.*)"/) {
+ $parsers{$cur_name} = $1;
+ }
if (/DEFLIST.*".*",(.*)$/) {
my $value = $1;
if ($value =~ /.*&(.*)\)/) {
@@ -87,15 +90,12 @@ foreach my $file (@ARGV) {
close $f;
}
-print "const struct all_settings_root all_roots[] = {\n";
+print "const struct setting_parser_info *all_roots[] = {\n";
foreach my $name (keys %parsers) {
- next if (!$parsers{$name});
+ my $module = $parsers{$name};
+ next if (!$module);
- my $module = "";
- if ($name =~ /^([^_]*)/) {
- $module = $1;
- }
- print " { \"$module\", &".$name." }, \n";
+ print "\t&".$name.", \n";
}
-print " { NULL, NULL }\n";
+print "\tNULL\n";
print "};\n";
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/dict/dict-settings.c
--- a/src/dict/dict-settings.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/dict/dict-settings.c Tue Oct 20 17:36:06 2009 -0400
@@ -23,6 +23,7 @@ struct dict_settings dict_default_settin
};
struct setting_parser_info dict_setting_parser_info = {
+ MEMBER(module_name) "dict",
MEMBER(defines) dict_setting_defines,
MEMBER(defaults) &dict_default_settings,
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/imap/imap-settings.c
--- a/src/imap/imap-settings.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/imap/imap-settings.c Tue Oct 20 17:36:06 2009 -0400
@@ -56,6 +56,7 @@ static struct setting_parser_info *imap_
};
struct setting_parser_info imap_setting_parser_info = {
+ MEMBER(module_name) "imap",
MEMBER(defines) imap_setting_defines,
MEMBER(defaults) &imap_default_settings,
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/lib-lda/lda-settings.c
--- a/src/lib-lda/lda-settings.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/lib-lda/lda-settings.c Tue Oct 20 17:36:06 2009 -0400
@@ -49,6 +49,7 @@ static struct setting_parser_info *lda_s
};
struct setting_parser_info lda_setting_parser_info = {
+ MEMBER(module_name) "lda",
MEMBER(defines) lda_setting_defines,
MEMBER(defaults) &lda_default_settings,
diff -r 5a25b4ec5694 -r dcda7c495eb6 src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c Tue Oct 20 17:15:01 2009 -0400
+++ b/src/lib-master/master-service-settings.c Tue Oct 20 17:36:06 2009 -0400
@@ -45,6 +45,7 @@ static struct master_service_settings ma
};
More information about the dovecot-cvs
mailing list