From: Timo Sirainen Date: Wed, 10 Feb 2021 19:18:42 +0000 (+0200) Subject: plugins: Use array_foreach_elem() where possible X-Git-Tag: 2.3.16~193 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3200ca5b9af192d3e25ff48b9b13cdc9ba9a98ca;p=thirdparty%2Fdovecot%2Fcore.git plugins: Use array_foreach_elem() where possible --- diff --git a/src/plugins/fts/fts-search-args.c b/src/plugins/fts/fts-search-args.c index 299fbfbfe9..b58b238a39 100644 --- a/src/plugins/fts/fts-search-args.c +++ b/src/plugins/fts/fts-search-args.c @@ -31,7 +31,7 @@ fts_search_arg_create_or(const struct mail_search_arg *orig_arg, pool_t pool, const ARRAY_TYPE(const_string) *tokens) { struct mail_search_arg *arg, *or_arg, **argp; - const char *const *tokenp; + const char *token; /* create the OR arg first as the parent */ or_arg = p_new(pool, struct mail_search_arg, 1); @@ -39,12 +39,12 @@ fts_search_arg_create_or(const struct mail_search_arg *orig_arg, pool_t pool, /* now create all the child args for the OR */ argp = &or_arg->value.subargs; - array_foreach(tokens, tokenp) { + array_foreach_elem(tokens, token) { arg = p_new(pool, struct mail_search_arg, 1); *arg = *orig_arg; arg->match_not = FALSE; /* we copied this to the root OR */ arg->next = NULL; - arg->value.str = p_strdup(pool, *tokenp); + arg->value.str = p_strdup(pool, token); *argp = arg; argp = &arg->next; @@ -149,7 +149,7 @@ static int fts_search_arg_expand(struct fts_backend *backend, pool_t pool, struct mail_search_arg **argp) { const ARRAY_TYPE(fts_user_language) *languages; - struct fts_user_language *const *langp; + struct fts_user_language *lang; struct mail_search_arg *or_arg, *orig_arg = *argp; const char *error, *orig_token = orig_arg->value.str; @@ -170,8 +170,8 @@ static int fts_search_arg_expand(struct fts_backend *backend, pool_t pool, or_arg->match_not = orig_arg->match_not; or_arg->next = orig_arg->next; - array_foreach(languages, langp) { - if (fts_backend_dovecot_tokenize_lang(*langp, pool, or_arg, + array_foreach_elem(languages, lang) { + if (fts_backend_dovecot_tokenize_lang(lang, pool, or_arg, orig_arg, orig_token, &error) < 0) { i_error("fts: %s", error); return -1; diff --git a/src/plugins/fts/fts-user.c b/src/plugins/fts/fts-user.c index 4bb1f414e0..ef2b3f2d85 100644 --- a/src/plugins/fts/fts-user.c +++ b/src/plugins/fts/fts-user.c @@ -234,13 +234,13 @@ struct fts_user_language * fts_user_language_find(struct mail_user *user, const struct fts_language *lang) { - struct fts_user_language *const *user_langp; + struct fts_user_language *user_lang; struct fts_user *fuser = FTS_USER_CONTEXT(user); i_assert(fuser != NULL); - array_foreach(&fuser->languages, user_langp) { - if (strcmp((*user_langp)->lang->name, lang->name) == 0) - return *user_langp; + array_foreach_elem(&fuser->languages, user_lang) { + if (strcmp(user_lang->lang->name, lang->name) == 0) + return user_lang; } return NULL; } @@ -267,10 +267,10 @@ static int fts_user_languages_fill_all(struct mail_user *user, struct fts_user *fuser, const char **error_r) { - const struct fts_language *const *langp; + const struct fts_language *lang; - array_foreach(fts_language_list_get_all(fuser->lang_list), langp) { - if (fts_user_language_create(user, fuser, *langp, error_r) < 0) + array_foreach_elem(fts_language_list_get_all(fuser->lang_list), lang) { + if (fts_user_language_create(user, fuser, lang, error_r) < 0) return -1; } return 0; @@ -348,13 +348,13 @@ static void fts_user_language_free(struct fts_user_language *user_lang) static void fts_user_free(struct fts_user *fuser) { - struct fts_user_language *const *user_langp; + struct fts_user_language *user_lang; if (fuser->lang_list != NULL) fts_language_list_deinit(&fuser->lang_list); - array_foreach(&fuser->languages, user_langp) - fts_user_language_free(*user_langp); + array_foreach_elem(&fuser->languages, user_lang) + fts_user_language_free(user_lang); } int fts_mail_user_init(struct mail_user *user, const char **error_r) diff --git a/src/plugins/mail-crypt/doveadm-mail-crypt.c b/src/plugins/mail-crypt/doveadm-mail-crypt.c index 409a9d69b4..a5c2be6507 100644 --- a/src/plugins/mail-crypt/doveadm-mail-crypt.c +++ b/src/plugins/mail-crypt/doveadm-mail-crypt.c @@ -188,7 +188,7 @@ static int mcp_update_shared_keys(struct doveadm_mail_cmd_context *ctx, return -1; } - const char *const *id; + const char *id; bool found = FALSE; string_t *uid = t_str_new(64); @@ -198,10 +198,10 @@ static int mcp_update_shared_keys(struct doveadm_mail_cmd_context *ctx, ret = 0; /* then perform sharing */ - array_foreach(&ids, id) { - if (strchr(*id, '/') != NULL) { + array_foreach_elem(&ids, id) { + if (strchr(id, '/') != NULL) { str_truncate(uid, 0); - const char *hexuid = t_strcut(*id, '/'); + const char *hexuid = t_strcut(id, '/'); hex_to_binary(hexuid, uid); if (mcp_update_shared_key(t, user, str_c(uid), key, &error) < 0) { @@ -575,16 +575,16 @@ static void mcp_key_list(struct mcp_cmd_context *ctx, mailbox_get_vname(box), error); } else { - const char *const *id; + const char *id; const char *boxname = mailbox_get_vname(box); if (value.value == NULL) value.value = ""; - array_foreach(&ids, id) { + array_foreach_elem(&ids, id) { struct generated_key key; key.name = boxname; - key.id = *id; + key.id = id; if (value.value != NULL) - key.active = strcmp(*id, value.value) == 0; + key.active = strcmp(id, value.value) == 0; else key.active = FALSE; key.box = box; diff --git a/src/plugins/mail-crypt/mail-crypt-acl-plugin.c b/src/plugins/mail-crypt/mail-crypt-acl-plugin.c index e68b9f2238..71ab1e771f 100644 --- a/src/plugins/mail-crypt/mail-crypt-acl-plugin.c +++ b/src/plugins/mail-crypt/mail-crypt-acl-plugin.c @@ -110,14 +110,14 @@ mail_crypt_acl_unset_private_keys(struct mailbox *src_box, struct mailbox_transaction_context *t; t = mailbox_transaction_begin(src_box, 0, __func__); - const char *const *hash; - array_foreach(&digests, hash) { + const char *hash; + array_foreach_elem(&digests, hash) { const char *ptr; /* if the id contains username part, skip to key public id */ - if ((ptr = strchr(*hash, '/')) != NULL) + if ((ptr = strchr(hash, '/')) != NULL) ptr++; else - ptr = *hash; + ptr = hash; if ((ret = mail_crypt_box_unset_shared_key(t, ptr, dest_user, error_r)) < 0) { ret = -1; @@ -180,7 +180,7 @@ mail_crypt_acl_update_private_key(struct mailbox *src_box, const char **error_r) { struct dcrypt_public_key *key = NULL; - struct dcrypt_private_key **keyp; + struct dcrypt_private_key *priv_key; int ret = 0; if (!set) { @@ -225,9 +225,8 @@ mail_crypt_acl_update_private_key(struct mailbox *src_box, dcrypt_key_unref_public(&key); if (ret >= 0) { - array_foreach_modifiable(&keys, keyp) { - dcrypt_key_unref_private(keyp); - } + array_foreach_elem(&keys, priv_key) + dcrypt_key_unref_private(&priv_key); } if (mailbox_transaction_commit(&t) < 0) { diff --git a/src/plugins/mail-crypt/mail-crypt-key.c b/src/plugins/mail-crypt/mail-crypt-key.c index 60c9c9b3f9..22c86e34cf 100644 --- a/src/plugins/mail-crypt/mail-crypt-key.c +++ b/src/plugins/mail-crypt/mail-crypt-key.c @@ -1115,12 +1115,11 @@ int mail_crypt_box_share_private_keys(struct mailbox_transaction_context *t, { i_assert(dest_user == NULL || dest_pub_key != NULL); - struct dcrypt_private_key *const *priv_keyp, *priv_key; + struct dcrypt_private_key *priv_key; buffer_t *key_id = t_str_new(MAIL_CRYPT_HASH_BUF_SIZE); int ret = 0; - array_foreach(priv_keys, priv_keyp) { - priv_key = *priv_keyp; + array_foreach_elem(priv_keys, priv_key) { ret = -1; if (!dcrypt_key_id_private(priv_key, MAIL_CRYPT_KEY_ID_ALGORITHM, key_id, error_r) || diff --git a/src/plugins/notify-status/notify-status-plugin.c b/src/plugins/notify-status/notify-status-plugin.c index 83bddb92ca..4fca59dc72 100644 --- a/src/plugins/notify-status/notify-status-plugin.c +++ b/src/plugins/notify-status/notify-status-plugin.c @@ -91,7 +91,7 @@ static bool notify_status_mailbox_enabled(struct mailbox *box) { struct mail_user *user = mail_storage_get_user(mailbox_get_storage(box)); struct notify_status_user *nuser = NOTIFY_STATUS_USER_CONTEXT(user); - struct imap_match_glob **glob; + struct imap_match_glob *glob; /* not enabled */ if (nuser == NULL) return FALSE; @@ -100,8 +100,8 @@ static bool notify_status_mailbox_enabled(struct mailbox *box) if (array_count(&nuser->patterns) == 0) return TRUE; - array_foreach_modifiable(&nuser->patterns, glob) { - if ((imap_match(*glob, mailbox_get_vname(box)) & IMAP_MATCH_YES) != 0) + array_foreach_elem(&nuser->patterns, glob) { + if ((imap_match(glob, mailbox_get_vname(box)) & IMAP_MATCH_YES) != 0) return TRUE; } return FALSE; diff --git a/src/plugins/push-notification/push-notification-driver-dlog.c b/src/plugins/push-notification/push-notification-driver-dlog.c index 364ad26c59..e0cf790a8d 100644 --- a/src/plugins/push-notification/push-notification-driver-dlog.c +++ b/src/plugins/push-notification/push-notification-driver-dlog.c @@ -28,14 +28,12 @@ static bool push_notification_driver_dlog_begin_txn( struct push_notification_driver_txn *dtxn) { - const struct push_notification_event *const *event; + const struct push_notification_event *event; i_debug("Called begin_txn push_notification plugin hook."); - array_foreach(&push_notification_events, event) { - push_notification_event_init(dtxn, (*event)->name, NULL); - } - + array_foreach_elem(&push_notification_events, event) + push_notification_event_init(dtxn, event->name, NULL); return TRUE; } @@ -44,16 +42,16 @@ push_notification_driver_dlog_process_mbox( struct push_notification_driver_txn *dtxn ATTR_UNUSED, struct push_notification_txn_mbox *mbox) { - struct push_notification_txn_event *const *event; + struct push_notification_txn_event *event; i_debug("Called process_mbox push_notification plugin hook."); i_debug("Mailbox data: Mailbox [%s]", mbox->mailbox); if (array_is_created(&mbox->eventdata)) { - array_foreach(&mbox->eventdata, event) { - if ((*event)->event->event->mbox.debug_mbox != NULL) - (*event)->event->event->mbox.debug_mbox(*event); + array_foreach_elem(&mbox->eventdata, event) { + if (event->event->event->mbox.debug_mbox != NULL) + event->event->event->mbox.debug_mbox(event); } } } @@ -63,7 +61,7 @@ push_notification_driver_dlog_process_msg( struct push_notification_driver_txn *dtxn ATTR_UNUSED, struct push_notification_txn_msg *msg) { - struct push_notification_txn_event *const *event; + struct push_notification_txn_event *event; i_debug("Called process_msg push_notification plugin hook."); @@ -71,10 +69,9 @@ push_notification_driver_dlog_process_msg( msg->mailbox, msg->uid, msg->uid_validity); if (array_is_created(&msg->eventdata)) { - array_foreach(&msg->eventdata, event) { - if ((*event)->event->event->msg.debug_msg != NULL) { - (*event)->event->event->msg.debug_msg(*event); - } + array_foreach_elem(&msg->eventdata, event) { + if (event->event->event->msg.debug_msg != NULL) + event->event->event->msg.debug_msg(event); } } } diff --git a/src/plugins/push-notification/push-notification-driver-lua.c b/src/plugins/push-notification/push-notification-driver-lua.c index aaa8a9f58f..629a581e77 100644 --- a/src/plugins/push-notification/push-notification-driver-lua.c +++ b/src/plugins/push-notification/push-notification-driver-lua.c @@ -138,15 +138,15 @@ push_notification_driver_lua_init_events( struct push_notification_driver_txn *dtxn) { struct dlua_push_notification_context *ctx = dtxn->duser->context; - const struct push_notification_event *const *event; + const struct push_notification_event *event; ctx->config_mn.flags = DLUA_DEFAULT_EVENTS; ctx->config_ma.flags = DLUA_DEFAULT_EVENTS; ctx->config_fc.store_old = TRUE; bool found_one = FALSE; /* Register *all* events that are present in Lua */ - array_foreach(push_notification_get_events(), event) { - const char *name = (*event)->name; + array_foreach_elem(push_notification_get_events(), event) { + const char *name = event->name; const char *fn = push_notification_driver_lua_to_fn(name); if (!dlua_script_has_function(ctx->script, fn)) continue; @@ -167,8 +167,8 @@ push_notification_driver_lua_init_events( } else if (strcmp(name, "FlagsClear") == 0) { push_notification_event_init(dtxn, name, &ctx->config_fc); - } else if ((*event)->init.default_config != NULL) { - void *config = (*event)->init.default_config(); + } else if (event->init.default_config != NULL) { + void *config = event->init.default_config(); push_notification_event_init(dtxn, name, config); } else { push_notification_event_init(dtxn, name, NULL); @@ -552,14 +552,14 @@ push_notification_driver_lua_process_mbox( struct push_notification_driver_txn *dtxn, struct push_notification_txn_mbox *mbox) { - struct push_notification_txn_event *const *event; + struct push_notification_txn_event *event; struct dlua_push_notification_context *ctx = dtxn->duser->context; struct dlua_push_notification_txn_context *tctx = dtxn->context; if (array_is_created(&mbox->eventdata)) { - array_foreach(&mbox->eventdata, event) { + array_foreach_elem(&mbox->eventdata, event) { push_notification_driver_lua_call(ctx, tctx, - (*event), mbox, NULL); + event, mbox, NULL); } } } @@ -569,14 +569,14 @@ push_notification_driver_lua_process_msg( struct push_notification_driver_txn *dtxn, struct push_notification_txn_msg *msg) { - struct push_notification_txn_event *const *event; + struct push_notification_txn_event *event; struct dlua_push_notification_context *ctx = dtxn->duser->context; struct dlua_push_notification_txn_context *tctx = dtxn->context; if (array_is_created(&msg->eventdata)) { - array_foreach(&msg->eventdata, event) { + array_foreach_elem(&msg->eventdata, event) { push_notification_driver_lua_call(ctx, tctx, - (*event), NULL, msg); + event, NULL, msg); } } } diff --git a/src/plugins/push-notification/push-notification-drivers.c b/src/plugins/push-notification/push-notification-drivers.c index 1f55b4360a..f8efef7b7e 100644 --- a/src/plugins/push-notification/push-notification-drivers.c +++ b/src/plugins/push-notification/push-notification-drivers.c @@ -124,14 +124,14 @@ int push_notification_driver_init( void push_notification_driver_cleanup_all(void) { - const struct push_notification_driver *const *driver; + const struct push_notification_driver *driver; /* Loop through driver list and perform global cleanup tasks. We may not have used all drivers in this plugin/worker, but the cleanup hooks are designed to ignore these unused drivers. */ - array_foreach(&push_notification_drivers, driver) { - if ((*driver)->v.cleanup != NULL) - (*driver)->v.cleanup(); + array_foreach_elem(&push_notification_drivers, driver) { + if (driver->v.cleanup != NULL) + driver->v.cleanup(); } } diff --git a/src/plugins/push-notification/push-notification-event-flagsclear.c b/src/plugins/push-notification/push-notification-event-flagsclear.c index 9b897a0caf..2ce0c3f192 100644 --- a/src/plugins/push-notification/push-notification-event-flagsclear.c +++ b/src/plugins/push-notification/push-notification-event-flagsclear.c @@ -27,7 +27,7 @@ push_notification_event_flagsclear_debug_msg( struct push_notification_txn_event *event) { struct push_notification_event_flagsclear_data *data = event->data; - const char *const *keyword; + const char *keyword; if ((data->flags_clear & MAIL_ANSWERED) != 0) i_debug("%s: Answered flag cleared", EVENT_NAME); @@ -40,8 +40,8 @@ push_notification_event_flagsclear_debug_msg( if ((data->flags_clear & MAIL_DRAFT) != 0) i_debug("%s: Draft flag cleared", EVENT_NAME); - array_foreach(&data->keywords_clear, keyword) - i_debug("%s: Keyword clear [%s]", EVENT_NAME, *keyword); + array_foreach_elem(&data->keywords_clear, keyword) + i_debug("%s: Keyword clear [%s]", EVENT_NAME, keyword); } static struct push_notification_event_flagsclear_data * diff --git a/src/plugins/push-notification/push-notification-event-flagsset.c b/src/plugins/push-notification/push-notification-event-flagsset.c index 6b0bd2c965..c596ced832 100644 --- a/src/plugins/push-notification/push-notification-event-flagsset.c +++ b/src/plugins/push-notification/push-notification-event-flagsset.c @@ -28,7 +28,7 @@ push_notification_event_flagsset_debug_msg( struct push_notification_txn_event *event) { struct push_notification_event_flagsset_data *data = event->data; - const char *const *keyword; + const char *keyword; if ((data->flags_set & MAIL_ANSWERED) != 0) i_debug("%s: Answered flag set", EVENT_NAME); @@ -41,8 +41,8 @@ push_notification_event_flagsset_debug_msg( if ((data->flags_set & MAIL_DRAFT) != 0) i_debug("%s: Draft flag set", EVENT_NAME); - array_foreach(&data->keywords_set, keyword) - i_debug("%s: Keyword set [%s]", EVENT_NAME, *keyword); + array_foreach_elem(&data->keywords_set, keyword) + i_debug("%s: Keyword set [%s]", EVENT_NAME, keyword); } static struct push_notification_event_flagsset_data * diff --git a/src/plugins/push-notification/push-notification-plugin.c b/src/plugins/push-notification/push-notification-plugin.c index 40ec57f6e0..22c2fb0ae0 100644 --- a/src/plugins/push-notification/push-notification-plugin.c +++ b/src/plugins/push-notification/push-notification-plugin.c @@ -45,7 +45,7 @@ static void push_notification_transaction_init(struct push_notification_txn *ptxn) { struct push_notification_driver_txn *dtxn; - struct push_notification_driver_user **duser; + struct push_notification_driver_user *duser; struct mail_storage *storage; if (ptxn->initialized) @@ -60,9 +60,9 @@ push_notification_transaction_init(struct push_notification_txn *ptxn) return; } - array_foreach_modifiable(&ptxn->puser->driverlist->drivers, duser) { + array_foreach_elem(&ptxn->puser->driverlist->drivers, duser) { dtxn = p_new(ptxn->pool, struct push_notification_driver_txn, 1); - dtxn->duser = *duser; + dtxn->duser = duser; dtxn->ptxn = ptxn; if ((dtxn->duser->driver->v.begin_txn == NULL) || @@ -102,14 +102,12 @@ static void push_notification_transaction_end(struct push_notification_txn *ptxn, bool success) { - struct push_notification_driver_txn **dtxn; + struct push_notification_driver_txn *dtxn; if (ptxn->initialized) { - array_foreach_modifiable(&ptxn->drivers, dtxn) { - if ((*dtxn)->duser->driver->v.end_txn != NULL) { - (*dtxn)->duser->driver->v.end_txn(*dtxn, - success); - } + array_foreach_elem(&ptxn->drivers, dtxn) { + if (dtxn->duser->driver->v.end_txn != NULL) + dtxn->duser->driver->v.end_txn(dtxn, success); } } @@ -303,7 +301,7 @@ static void push_notification_user_deinit(struct mail_user *user) struct push_notification_user *puser = PUSH_NOTIFICATION_USER_CONTEXT(user); struct push_notification_driver_list *dlist = puser->driverlist; - struct push_notification_driver_user **duser; + struct push_notification_driver_user *duser; struct ioloop *prev_ioloop = current_ioloop; /* Make sure we're in the main ioloop, so if the deinit/cleanup moves @@ -311,11 +309,11 @@ static void push_notification_user_deinit(struct mail_user *user) */ io_loop_set_current(main_ioloop); - array_foreach_modifiable(&dlist->drivers, duser) { - if ((*duser)->driver->v.deinit != NULL) - (*duser)->driver->v.deinit(*duser); - if ((*duser)->driver->v.cleanup != NULL) - (*duser)->driver->v.cleanup(); + array_foreach_elem(&dlist->drivers, duser) { + if (duser->driver->v.deinit != NULL) + duser->driver->v.deinit(duser); + if (duser->driver->v.cleanup != NULL) + duser->driver->v.cleanup(); } io_loop_set_current(prev_ioloop); diff --git a/src/plugins/push-notification/push-notification-triggers.c b/src/plugins/push-notification/push-notification-triggers.c index 4e403c5a3d..388298291d 100644 --- a/src/plugins/push-notification/push-notification-triggers.c +++ b/src/plugins/push-notification/push-notification-triggers.c @@ -29,17 +29,15 @@ void push_notification_trigger_mbox_create( struct push_notification_txn *txn, struct mailbox *box, struct push_notification_txn_mbox *mbox) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_mbox_common( txn, box, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->mbox_triggers.create != NULL) { - (*ec)->event->mbox_triggers.create( - txn, *ec, mbox); - } + array_foreach_elem(&txn->events, ec) { + if (ec->event->mbox_triggers.create != NULL) + ec->event->mbox_triggers.create(txn, ec, mbox); } } } @@ -48,17 +46,15 @@ void push_notification_trigger_mbox_delete( struct push_notification_txn *txn, struct mailbox *box, struct push_notification_txn_mbox *mbox) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_mbox_common( txn, box, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->mbox_triggers.delete != NULL) { - (*ec)->event->mbox_triggers.delete( - txn, *ec, mbox); - } + array_foreach_elem(&txn->events, ec) { + if (ec->event->mbox_triggers.delete != NULL) + ec->event->mbox_triggers.delete(txn, ec, mbox); } } } @@ -68,16 +64,16 @@ void push_notification_trigger_mbox_rename( struct mailbox *src, struct mailbox *dest, struct push_notification_txn_mbox *mbox) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_mbox_common( txn, dest, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->mbox_triggers.rename != NULL) { - (*ec)->event->mbox_triggers.rename( - txn, *ec, mbox, src); + array_foreach_elem(&txn->events, ec) { + if (ec->event->mbox_triggers.rename != NULL) { + ec->event->mbox_triggers.rename( + txn, ec, mbox, src); } } } @@ -87,23 +83,23 @@ void push_notification_trigger_mbox_subscribe( struct push_notification_txn *txn, struct mailbox *box, bool subscribed, struct push_notification_txn_mbox *mbox) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_mbox_common( txn, box, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { + array_foreach_elem(&txn->events, ec) { if (subscribed == TRUE) { - if ((*ec)->event->mbox_triggers.subscribe != NULL) { - (*ec)->event->mbox_triggers.subscribe( - txn, *ec, mbox); + if (ec->event->mbox_triggers.subscribe != NULL) { + ec->event->mbox_triggers.subscribe( + txn, ec, mbox); } } else { - if ((*ec)->event->mbox_triggers.unsubscribe != NULL) { - (*ec)->event->mbox_triggers.unsubscribe( - txn, *ec, mbox); + if (ec->event->mbox_triggers.unsubscribe != NULL) { + ec->event->mbox_triggers.unsubscribe( + txn, ec, mbox); } } } @@ -126,16 +122,16 @@ void push_notification_trigger_msg_save_new( struct push_notification_txn *txn, struct mail *mail, struct push_notification_txn_msg *msg) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_msg_common( txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->msg_triggers.save != NULL) { - (*ec)->event->msg_triggers.save( - txn, *ec, msg, mail); + array_foreach_elem(&txn->events, ec) { + if (ec->event->msg_triggers.save != NULL) { + ec->event->msg_triggers.save( + txn, ec, msg, mail); } } } @@ -145,17 +141,17 @@ void push_notification_trigger_msg_save_append( struct push_notification_txn *txn, struct mail *mail, struct push_notification_txn_msg *msg) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_msg_common( txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->msg_triggers.append != NULL) { - (*ec)->event->msg_triggers.append( - txn, *ec, msg, mail); + array_foreach_elem(&txn->events, ec) { + if (ec->event->msg_triggers.append != NULL) { + ec->event->msg_triggers.append( + txn, ec, msg, mail); } } } @@ -165,17 +161,15 @@ void push_notification_trigger_msg_save_expunge( struct push_notification_txn *txn, struct mail *mail, struct push_notification_txn_msg *msg) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_msg_common( txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->msg_triggers.expunge != NULL) { - (*ec)->event->msg_triggers.expunge( - txn, *ec, msg); - } + array_foreach_elem(&txn->events, ec) { + if (ec->event->msg_triggers.expunge != NULL) + ec->event->msg_triggers.expunge(txn, ec, msg); } } } @@ -184,17 +178,17 @@ void push_notification_trigger_msg_flag_change( struct push_notification_txn *txn, struct mail *mail, struct push_notification_txn_msg *msg, enum mail_flags old_flags) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_msg_common( txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->msg_triggers.flagchange != NULL) { - (*ec)->event->msg_triggers.flagchange( - txn, *ec, msg, mail, old_flags); + array_foreach_elem(&txn->events, ec) { + if (ec->event->msg_triggers.flagchange != NULL) { + ec->event->msg_triggers.flagchange( + txn, ec, msg, mail, old_flags); } } } @@ -204,17 +198,17 @@ void push_notification_trigger_msg_keyword_change( struct push_notification_txn *txn, struct mail *mail, struct push_notification_txn_msg *msg, const char *const *old_keywords) { - struct push_notification_event_config **ec; + struct push_notification_event_config *ec; push_notification_trigger_msg_common( txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE); if (array_is_created(&txn->events)) { - array_foreach_modifiable(&txn->events, ec) { - if ((*ec)->event->msg_triggers.keywordchange != NULL) { - (*ec)->event->msg_triggers.keywordchange( - txn, *ec, msg, mail, old_keywords); + array_foreach_elem(&txn->events, ec) { + if (ec->event->msg_triggers.keywordchange != NULL) { + ec->event->msg_triggers.keywordchange( + txn, ec, msg, mail, old_keywords); } } }