}
static void
-config_dump_full_stdout_callback(const char *key, const char *value,
- enum config_key_type type ATTR_UNUSED,
+config_dump_full_stdout_callback(const struct config_export_setting *set,
void *context)
{
struct dump_context *ctx = context;
}
T_BEGIN {
o_stream_nsend_str(ctx->output, t_strdup_printf(
- "%s=%s\n", key, str_tabescape(value)));
+ "%s=%s\n", set->key, str_tabescape(set->value)));
} T_END;
}
-static void config_dump_full_callback(const char *key, const char *value,
- enum config_key_type type ATTR_UNUSED,
+static void config_dump_full_callback(const struct config_export_setting *set,
void *context)
{
struct dump_context *ctx = context;
ctx->filter_written = TRUE;
}
if (ctx->delayed_output != NULL &&
- ((str_begins(key, "passdb", &suffix) &&
+ ((str_begins(set->key, "passdb", &suffix) &&
(suffix[0] == '\0' || suffix[0] == '/')) ||
- (str_begins(key, "userdb", &suffix) &&
+ (str_begins(set->key, "userdb", &suffix) &&
(suffix[0] == '\0' || suffix[0] == '/')))) {
/* For backwards compatibility: global passdbs and userdbs are
added after per-protocol ones, not before. */
- str_append_data(ctx->delayed_output, key, strlen(key)+1);
- str_append_data(ctx->delayed_output, value, strlen(value)+1);
+ str_append_data(ctx->delayed_output, set->key,
+ strlen(set->key)+1);
+ str_append_data(ctx->delayed_output, set->value,
+ strlen(set->value)+1);
} else {
- o_stream_nsend(ctx->output, key, strlen(key)+1);
- o_stream_nsend(ctx->output, value, strlen(value)+1);
+ o_stream_nsend(ctx->output, set->key, strlen(set->key)+1);
+ o_stream_nsend(ctx->output, set->value, strlen(set->value)+1);
}
}
hash_table_insert(ctx->keys, def->key, def->key);
/* for doveconf -n to see this KEY_LIST */
- ctx->callback(def->key, "", CONFIG_KEY_LIST, ctx->context);
+ struct config_export_setting export_set = {
+ .type = CONFIG_KEY_LIST,
+ .key = def->key,
+ .value = "",
+ };
+ ctx->callback(&export_set, ctx->context);
strings = array_get(val, &count);
i_assert(count % 2 == 0);
def->key,
SETTINGS_SEPARATOR,
strings[i]);
- ctx->callback(str, strings[i+1],
- CONFIG_KEY_NORMAL, ctx->context);
+ struct config_export_setting export_set = {
+ .type = CONFIG_KEY_NORMAL,
+ .key = str,
+ .value = strings[i+1],
+ };
+ ctx->callback(&export_set, ctx->context);
} T_END;
break;
}
type = CONFIG_KEY_FILTER_ARRAY;
else
type = CONFIG_KEY_NORMAL;
- ctx->callback(def->key, str_c(ctx->value), type,
- ctx->context);
+ struct config_export_setting export_set = {
+ .type = type,
+ .key = def->key,
+ .value = str_c(ctx->value),
+ };
+ ctx->callback(&export_set, ctx->context);
if ((ctx->flags & CONFIG_DUMP_FLAG_DEDUPLICATE_KEYS) != 0)
hash_table_insert(ctx->keys, def->key, def->key);
}
CONFIG_KEY_FILTER_ARRAY,
};
-typedef void config_request_callback_t(const char *key, const char *value,
- enum config_key_type type, void *context);
+struct config_export_setting {
+ enum config_key_type type;
+ const char *key;
+ const char *value;
+};
+
+typedef void config_request_callback_t(const struct config_export_setting *set,
+ void *context);
bool config_export_type(string_t *str, const void *value,
const void *default_value,
static void
-config_request_get_strings(const char *key, const char *value,
- enum config_key_type type, void *context)
+config_request_get_strings(const struct config_export_setting *set,
+ void *context)
{
struct config_dump_human_context *ctx = context;
+ const char *value;
- switch (type) {
+ switch (set->type) {
case CONFIG_KEY_NORMAL:
- value = p_strdup_printf(ctx->pool, "%s=%s", key, value);
+ value = p_strdup_printf(ctx->pool, "%s=%s", set->key, set->value);
break;
case CONFIG_KEY_LIST:
value = p_strdup_printf(ctx->pool, LIST_KEY_PREFIX"%s=%s",
- key, value);
+ set->key, set->value);
break;
case CONFIG_KEY_FILTER_ARRAY:
return;