From: Timo Sirainen Date: Mon, 17 Apr 2023 22:29:49 +0000 (+0300) Subject: lib-master, global: Rename MASTER_SERVICE_VAR_EXPAND_* macros to SETTINGS_VAR_EXPAND_* X-Git-Tag: 2.4.0~2158 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b6c5542f9db1351841dae84ec075a09fb77c7fe;p=thirdparty%2Fdovecot%2Fcore.git lib-master, global: Rename MASTER_SERVICE_VAR_EXPAND_* macros to SETTINGS_VAR_EXPAND_* --- diff --git a/src/lib-master/master-service-settings.c b/src/lib-master/master-service-settings.c index 386ace0c90..3475dc04f1 100644 --- a/src/lib-master/master-service-settings.c +++ b/src/lib-master/master-service-settings.c @@ -1100,14 +1100,14 @@ master_service_var_expand_init(struct event *event, while (event != NULL) { master_service_settings_var_expand_t *callback = - event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_CALLBACK); + event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK); if (callback != NULL) { callback(event, tab_r, func_tab_r); break; } - *tab_r = event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_TABLE); - *func_tab_r = event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_TABLE); + *tab_r = event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_TABLE); + *func_tab_r = event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_TABLE); if (*tab_r != NULL || *func_tab_r != NULL) break; event = event_get_parent(event); @@ -1115,7 +1115,7 @@ master_service_var_expand_init(struct event *event, if (*tab_r == NULL) *tab_r = t_new(struct var_expand_table, 1); *func_context_r = event == NULL ? NULL : - event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT); + event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT); } static int settings_override_cmp(const struct settings_override *set1, diff --git a/src/lib-master/master-service-settings.h b/src/lib-master/master-service-settings.h index cfa3038260..9f93e0b2c0 100644 --- a/src/lib-master/master-service-settings.h +++ b/src/lib-master/master-service-settings.h @@ -97,38 +97,38 @@ struct master_service_settings_output { expected to be accessible until the event is freed or the table is cleared from the event. Usage: - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_TABLE, var_expand_table); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_TABLE, var_expand_table); */ -#define MASTER_SERVICE_VAR_EXPAND_TABLE \ - "master_service_var_expand_table" +#define SETTINGS_EVENT_VAR_EXPAND_TABLE \ + "settings_var_expand_table" /* Set struct var_expand_func_table and its function context pointer to be used for settings expansion. The table is expected to be accessible until the event is freed or the table is cleared from the event. Usage: - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_TABLE, func_table); - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, func_context); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_TABLE, func_table); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT, func_context); - You can set either or both of MASTER_SERVICE_VAR_EXPAND_TABLE and - MASTER_SERVICE_VAR_EXPAND_FUNC_TABLE for the same event. The parent events + You can set either or both of SETTINGS_EVENT_VAR_EXPAND_TABLE and + SETTINGS_EVENT_VAR_EXPAND_FUNC_TABLE for the same event. The parent events won't be searched for either of them if either one is set. */ -#define MASTER_SERVICE_VAR_EXPAND_FUNC_TABLE \ - "master_service_var_expand_func_table" -#define MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT \ - "master_service_var_expand_func_context" +#define SETTINGS_EVENT_VAR_EXPAND_FUNC_TABLE \ + "settings_var_expand_func_table" +#define SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT \ + "settings_var_expand_func_context" /* Set a master_service_settings_var_expand_t callback that returns var_expand_[func_]table for settings expansion. This can be used instead of - MASTER_SERVICE_VAR_EXPAND_[FUNC_]TABLE to dynamically generate the table - on-demand. If this is found from the event, all other MASTER_SERVICE_VAR_* + SETTINGS_EVENT_VAR_EXPAND_[FUNC_]TABLE to dynamically generate the table + on-demand. If this is found from the event, all other SETTINGS_EVENT_VAR_* fields are ignored in this and the parent events. Usage: - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_CALLBACK, callback); - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, func_context); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK, callback); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT, func_context); */ -#define MASTER_SERVICE_VAR_EXPAND_CALLBACK \ - "master_service_var_expand_callback" -/* Callback function used with MASTER_SERVICE_VAR_EXPAND_CALLBACK. The function +#define SETTINGS_EVENT_VAR_EXPAND_CALLBACK \ + "settings_var_expand_callback" +/* Callback function used with SETTINGS_EVENT_VAR_EXPAND_CALLBACK. The function can return either or both of tab_r and func_tab_r, using NULL for the field that isn't needed. */ typedef void @@ -155,9 +155,9 @@ master_service_get_service_settings(struct master_service *service); Settings have their %variables expanded, unless SETTINGS_GET_FLAG_NO_EXPAND is used. The event and its - parents are scanned for MASTER_SERVICE_VAR_EXPAND_* pointers. The first + parents are scanned for SETTINGS_EVENT_VAR_EXPAND_* pointers. The first callback or tables that are found in the event hierarchy are used for the - expansion. See MASTER_SERVICE_VAR_EXPAND_* macros for more details. */ + expansion. See SETTINGS_EVENT_VAR_EXPAND_* macros for more details. */ int settings_get(struct event *event, const struct setting_parser_info *info, enum settings_get_flags flags, diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index 0726c0b491..697c08e870 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -732,7 +732,7 @@ mail_storage_service_var_expand_callback(struct event *event, const struct var_expand_func_table **func_tab_r) { struct mail_storage_service_init_var_expand_ctx *var_expand_ctx = - event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT); + event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT); i_assert(var_expand_ctx != NULL); *tab_r = get_var_expand_table(var_expand_ctx->ctx->service, @@ -1070,9 +1070,9 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, This is used only for settings lookups while inside this function, and it is cleared before we exit this function. Afterwards any settings lookups are expected to be using mail_user.event. */ - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_CALLBACK, + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK, mail_storage_service_var_expand_callback); - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT, &var_expand_ctx); if (settings_get(event, &mail_user_setting_parser_info, 0, &user_set, error_r) < 0) { @@ -1217,8 +1217,8 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, else { /* The context points to a variable in stack, so it can't be used anymore. */ - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_CALLBACK, NULL); - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, NULL); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK, NULL); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT, NULL); } *user_r = user; return ret; diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c index 4b40b2fcad..0b6073cd23 100644 --- a/src/lib-storage/mail-user.c +++ b/src/lib-storage/mail-user.c @@ -68,7 +68,7 @@ mail_user_var_expand_callback(struct event *event, const struct var_expand_func_table **func_tab_r) { struct mail_user *user = - event_get_ptr(event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT); + event_get_ptr(event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT); i_assert(user != NULL); *tab_r = mail_user_var_expand_table(user); @@ -102,9 +102,9 @@ mail_user_alloc(struct mail_storage_service_user *service_user) /* Register %variable expansion callback function for settings lookups. */ - event_set_ptr(user->event, MASTER_SERVICE_VAR_EXPAND_CALLBACK, + event_set_ptr(user->event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK, mail_user_var_expand_callback); - event_set_ptr(user->event, MASTER_SERVICE_VAR_EXPAND_FUNC_CONTEXT, user); + event_set_ptr(user->event, SETTINGS_EVENT_VAR_EXPAND_FUNC_CONTEXT, user); user->v.deinit = mail_user_deinit_base; user->v.deinit_pre = mail_user_deinit_pre_base; diff --git a/src/lmtp/lmtp-client.c b/src/lmtp/lmtp-client.c index 2f08e01d56..192e310de5 100644 --- a/src/lmtp/lmtp-client.c +++ b/src/lmtp/lmtp-client.c @@ -122,7 +122,7 @@ static void client_read_settings(struct client *client, bool ssl) mail_storage_service_get_var_expand_table(storage_service, &input); struct event *event = event_create(client->event); - event_set_ptr(event, MASTER_SERVICE_VAR_EXPAND_TABLE, (void *)tab); + event_set_ptr(event, SETTINGS_EVENT_VAR_EXPAND_TABLE, (void *)tab); if (settings_get(event, &lda_setting_parser_info, 0, &client->lda_set, &error) < 0 || settings_get(event, &lmtp_setting_parser_info, 0, diff --git a/src/login-common/client-common.c b/src/login-common/client-common.c index 114df4e8f1..c1d8613652 100644 --- a/src/login-common/client-common.c +++ b/src/login-common/client-common.c @@ -271,7 +271,7 @@ int client_alloc(int fd, const struct master_service_connection *conn, event_add_str(client->event, "service", login_binary->protocol); /* Get settings before using log callback */ - event_set_ptr(client->event, MASTER_SERVICE_VAR_EXPAND_CALLBACK, + event_set_ptr(client->event, SETTINGS_EVENT_VAR_EXPAND_CALLBACK, client_var_expand_callback); event_set_ptr(client->event, "client", client); if (client_settings_get(client, &error) < 0) {