From: Timo Sirainen Date: Thu, 7 Nov 2019 16:51:37 +0000 (+0200) Subject: push-notification: Simplify code with p_strarray_dup() X-Git-Tag: 2.3.10~280 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1256df390370c1bddca02252425e5e4eb42dfa02;p=thirdparty%2Fdovecot%2Fcore.git push-notification: Simplify code with p_strarray_dup() --- diff --git a/src/plugins/push-notification/push-notification-event-message-common.c b/src/plugins/push-notification/push-notification-event-message-common.c index 3d3f12c8a2..46a6319b20 100644 --- a/src/plugins/push-notification/push-notification-event-message-common.c +++ b/src/plugins/push-notification/push-notification-event-message-common.c @@ -1,7 +1,6 @@ /* Copyright (c) 2015-2019 Dovecot authors, see the included COPYING file */ #include "lib.h" -#include "array.h" #include "mail-storage.h" #include "push-notification-event-message-common.h" @@ -58,15 +57,7 @@ void push_notification_message_fill(struct mail *mail, pool_t pool, if ((*keywords == NULL) && (event_flags & PUSH_NOTIFICATION_MESSAGE_KEYWORDS) != 0) { - const char *const *mail_kws = mail_get_keywords(mail); - ARRAY_TYPE(const_string) kws; - p_array_init(&kws, pool, 2); - for (;*mail_kws != NULL; mail_kws++) { - value = p_strdup(pool, *mail_kws); - array_append(&kws, &value, 1); - } - array_append_zero(&kws); - *keywords = array_idx(&kws, 0); + *keywords = p_strarray_dup(pool, mail_get_keywords(mail)); } if ((*snippet == NULL) &&