config-request.c (dovecot-2.3.16) | : | config-request.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
pool_t pool; | pool_t pool; | |||
string_t *value; | string_t *value; | |||
string_t *prefix; | string_t *prefix; | |||
HASH_TABLE(char *, char *) keys; | HASH_TABLE(char *, char *) keys; | |||
enum config_dump_scope scope; | enum config_dump_scope scope; | |||
config_request_callback_t *callback; | config_request_callback_t *callback; | |||
void *context; | void *context; | |||
const char *const *modules; | const char *const *modules; | |||
const char *const *exclude_settings; | ||||
enum config_dump_flags flags; | enum config_dump_flags flags; | |||
const struct config_module_parser *parsers; | const struct config_module_parser *parsers; | |||
struct config_module_parser *dup_parsers; | struct config_module_parser *dup_parsers; | |||
struct master_service_settings_output output; | struct master_service_settings_output output; | |||
bool failed; | bool failed; | |||
}; | }; | |||
static void config_export_size(string_t *str, uoff_t size) | static void config_export_size(string_t *str, uoff_t size) | |||
{ | { | |||
skipping to change at line 209 | skipping to change at line 210 | |||
str_printfa(str, "%u", idx); | str_printfa(str, "%u", idx); | |||
return; | return; | |||
} | } | |||
name_offset = def->list_info->type_offset; | name_offset = def->list_info->type_offset; | |||
i_assert(name_offset != SIZE_MAX); | i_assert(name_offset != SIZE_MAX); | |||
name = CONST_PTR_OFFSET(set, name_offset); | name = CONST_PTR_OFFSET(set, name_offset); | |||
if (*name == NULL || **name == '\0') { | if (*name == NULL || **name == '\0') { | |||
/* no name, this one isn't unique. use the index. */ | /* no name, this one isn't unique. use the index. */ | |||
str_printfa(str, "%u", idx); | str_printfa(str, "%u", idx); | |||
} else { | } else T_BEGIN { | |||
str_append(str, settings_section_escape(*name)); | str_append(str, settings_section_escape(*name)); | |||
} | } T_END; | |||
} | } | |||
static void | static void | |||
settings_export(struct config_export_context *ctx, | settings_export(struct config_export_context *ctx, | |||
const struct setting_parser_info *info, | const struct setting_parser_info *info, | |||
bool parent_unique_deflist, | bool parent_unique_deflist, | |||
const void *set, const void *change_set) | const void *set, const void *change_set) | |||
{ | { | |||
const struct setting_define *def; | const struct setting_define *def; | |||
const void *value, *default_value, *change_value; | const void *value, *default_value, *change_value; | |||
void *const *children, *const *change_children = NULL; | void *const *children, *const *change_children = NULL; | |||
unsigned int i, count, count2; | unsigned int i, count, count2; | |||
size_t prefix_len; | size_t prefix_len; | |||
const char *str; | const char *str; | |||
char *key; | char *key; | |||
bool dump, dump_default = FALSE; | bool dump, dump_default = FALSE; | |||
for (def = info->defines; def->key != NULL; def++) { | for (def = info->defines; def->key != NULL; def++) { | |||
if (ctx->exclude_settings != NULL && | ||||
str_array_find(ctx->exclude_settings, def->key)) | ||||
continue; | ||||
value = CONST_PTR_OFFSET(set, def->offset); | value = CONST_PTR_OFFSET(set, def->offset); | |||
default_value = info->defaults == NULL ? NULL : | default_value = info->defaults == NULL ? NULL : | |||
CONST_PTR_OFFSET(info->defaults, def->offset); | CONST_PTR_OFFSET(info->defaults, def->offset); | |||
change_value = CONST_PTR_OFFSET(change_set, def->offset); | change_value = CONST_PTR_OFFSET(change_set, def->offset); | |||
switch (ctx->scope) { | switch (ctx->scope) { | |||
case CONFIG_DUMP_SCOPE_ALL_WITH_HIDDEN: | case CONFIG_DUMP_SCOPE_ALL_WITH_HIDDEN: | |||
dump_default = TRUE; | dump_default = TRUE; | |||
break; | break; | |||
case CONFIG_DUMP_SCOPE_ALL_WITHOUT_HIDDEN: | case CONFIG_DUMP_SCOPE_ALL_WITHOUT_HIDDEN: | |||
if ((def->flags & SET_FLAG_HIDDEN) == 0) { | if ((def->flags & SET_FLAG_HIDDEN) == 0) { | |||
skipping to change at line 376 | skipping to change at line 381 | |||
settings_export(ctx, def->list_info, | settings_export(ctx, def->list_info, | |||
def->type == SET_DEFLIST_UNIQUE, | def->type == SET_DEFLIST_UNIQUE, | |||
children[i], change_children[i]); | children[i], change_children[i]); | |||
str_truncate(ctx->prefix, prefix_len); | str_truncate(ctx->prefix, prefix_len); | |||
} | } | |||
} | } | |||
} | } | |||
struct config_export_context * | struct config_export_context * | |||
config_export_init(const char *const *modules, enum config_dump_scope scope, | config_export_init(const char *const *modules, | |||
const char *const *exclude_settings, | ||||
enum config_dump_scope scope, | ||||
enum config_dump_flags flags, | enum config_dump_flags flags, | |||
config_request_callback_t *callback, void *context) | config_request_callback_t *callback, void *context) | |||
{ | { | |||
struct config_export_context *ctx; | struct config_export_context *ctx; | |||
pool_t pool; | pool_t pool; | |||
pool = pool_alloconly_create(MEMPOOL_GROWING"config export", 1024*64); | pool = pool_alloconly_create(MEMPOOL_GROWING"config export", 1024*64); | |||
ctx = p_new(pool, struct config_export_context, 1); | ctx = p_new(pool, struct config_export_context, 1); | |||
ctx->pool = pool; | ctx->pool = pool; | |||
ctx->modules = modules == NULL ? NULL : p_strarray_dup(pool, modules); | ctx->modules = modules == NULL ? NULL : p_strarray_dup(pool, modules); | |||
ctx->exclude_settings = exclude_settings == NULL ? NULL : | ||||
p_strarray_dup(pool, exclude_settings); | ||||
ctx->flags = flags; | ctx->flags = flags; | |||
ctx->callback = callback; | ctx->callback = callback; | |||
ctx->context = context; | ctx->context = context; | |||
ctx->scope = scope; | ctx->scope = scope; | |||
ctx->value = str_new(pool, 256); | ctx->value = str_new(pool, 256); | |||
ctx->prefix = str_new(pool, 64); | ctx->prefix = str_new(pool, 64); | |||
hash_table_create(&ctx->keys, ctx->pool, 0, str_hash, strcmp); | hash_table_create(&ctx->keys, ctx->pool, 0, str_hash, strcmp); | |||
return ctx; | return ctx; | |||
} | } | |||
End of changes. 6 change blocks. | ||||
3 lines changed or deleted | 12 lines changed or added |