]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: acllist rebuild - Move data stack frame to caller's loop
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 21 Sep 2021 14:03:45 +0000 (17:03 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 22 Sep 2021 11:11:23 +0000 (11:11 +0000)
src/plugins/acl/acl-backend-vfile-acllist.c

index 507430f9bb1a238fde89477226876a74c9e2a106..c6029a2d1c9f78f3717fa50185218304c2695bf2 100644 (file)
@@ -199,12 +199,8 @@ acllist_append(struct acl_backend_vfile *backend, struct ostream *output,
                acllist.name = p_strdup(backend->acllist_pool, name);
                array_push_back(&backend->acllist, &acllist);
 
-               T_BEGIN {
-                       const char *line;
-                       line = t_strdup_printf("%s %s\n",
-                                              dec2str(acllist.mtime), name);
-                       o_stream_nsend_str(output, line);
-               } T_END;
+               o_stream_nsend_str(output, t_strdup_printf(
+                       "%s %s\n", dec2str(acllist.mtime), name));
        }
        acl_object_deinit(&aclobj);
        return ret < 0 ? -1 : 0;
@@ -273,12 +269,9 @@ acl_backend_vfile_acllist_try_rebuild(struct acl_backend_vfile *backend)
        iter = mailbox_list_iter_init(list, "*",
                                      MAILBOX_LIST_ITER_RAW_LIST |
                                      MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
-       while ((info = mailbox_list_iter_next(iter)) != NULL) {
-               if (acllist_append(backend, output, info->vname) < 0) {
-                       ret = -1;
-                       break;
-               }
-       }
+       while (ret == 0 && (info = mailbox_list_iter_next(iter)) != NULL) T_BEGIN {
+               ret = acllist_append(backend, output, info->vname);
+       } T_END;
 
        if (o_stream_finish(output) < 0) {
                i_error("write(%s) failed: %s", str_c(path),