]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
push-notification: Simplify code with p_strarray_dup()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 Nov 2019 16:51:37 +0000 (18:51 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 22 Nov 2019 08:35:08 +0000 (08:35 +0000)
src/plugins/push-notification/push-notification-event-message-common.c

index 3d3f12c8a2d2bcce892ff5795e2d6cfee3eb6a76..46a6319b201206f3a98db791a8d32a06ef2237a7 100644 (file)
@@ -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) &&