]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed pool parameter from mail_namespaces_init*(). Use mail_user's pool intead.
authorTimo Sirainen <tss@iki.fi>
Tue, 12 Aug 2008 18:54:27 +0000 (14:54 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 12 Aug 2008 18:54:27 +0000 (14:54 -0400)
--HG--
branch : HEAD

src/deliver/deliver.c
src/imap/main.c
src/lib-storage/mail-namespace.c
src/lib-storage/mail-namespace.h
src/plugins/convert/convert-storage.c
src/plugins/convert/convert-tool.c
src/plugins/expire/expire-tool.c
src/pop3/main.c

index f8edc5105384cc6fdcb8a8d66580a396ad0c05fe..d84aefb1c99ee3a02f4fd552811ea44a50aa4943 100644 (file)
@@ -787,7 +787,6 @@ int main(int argc, char *argv[])
        struct mailbox_header_lookup_ctx *headers_ctx;
        struct mail *mail;
        uid_t process_euid;
-       pool_t namespace_pool;
        bool stderr_rejection = FALSE;
        bool keep_environment = FALSE;
        bool user_auth = FALSE;
@@ -1002,14 +1001,13 @@ int main(int argc, char *argv[])
 
        module_dir_init(modules);
 
-       namespace_pool = pool_alloconly_create("namespaces", 1024);
        mail_user = mail_user_init(user, home);
-       if (mail_namespaces_init(namespace_pool, mail_user) < 0)
+       if (mail_namespaces_init(mail_user) < 0)
                i_fatal("Namespace initialization failed");
 
        /* create a separate mail user for the internal namespace */
        raw_mail_user = mail_user_init(user, NULL);
-       raw_ns = mail_namespaces_init_empty(namespace_pool, raw_mail_user);
+       raw_ns = mail_namespaces_init_empty(raw_mail_user);
        raw_ns->flags |= NAMESPACE_FLAG_INTERNAL;
 
        if (mail_storage_create(raw_ns, "raw", "/tmp",
index df2ca22a2e69db0fcc207bfb617396cf72e06c0a..eb4156784d3bdf753df6b9b0545f9234a4d9e735 100644 (file)
@@ -47,7 +47,6 @@ const char *imap_id_send, *imap_id_log;
 static struct io *log_io = NULL;
 static struct module *modules = NULL;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
-static pool_t namespace_pool;
 
 void (*hook_client_created)(struct client **client) = NULL;
 
@@ -229,9 +228,8 @@ static void main_init(void)
 
         parse_workarounds();
 
-       namespace_pool = pool_alloconly_create("namespaces", 1024);
        user = mail_user_init(username, home);
-       if (mail_namespaces_init(namespace_pool, user) < 0)
+       if (mail_namespaces_init(user) < 0)
                i_fatal("Namespace initialization failed");
        client = client_create(0, 1, user);
 
@@ -275,7 +273,6 @@ static void main_deinit(void)
        commands_deinit();
         mail_storage_deinit();
        dict_driver_unregister(&dict_driver_client);
-       pool_unref(&namespace_pool);
 
        str_free(&capability_string);
 
index 6c66e5d701d48f21656c3b80923da31fe1fadb4c..893f70df299c0d0e40109df8b0ff10dad9d5aee2 100644 (file)
@@ -28,14 +28,14 @@ void mail_namespace_init_storage(struct mail_namespace *ns)
 }
 
 static struct mail_namespace *
-namespace_add_env(pool_t pool, const char *data, unsigned int num,
+namespace_add_env(const char *data, unsigned int num,
                  struct mail_user *user, enum mail_storage_flags flags,
                  enum file_lock_method lock_method)
 {
         struct mail_namespace *ns;
        const char *sep, *type, *prefix, *error;
 
-       ns = p_new(pool, struct mail_namespace, 1);
+       ns = p_new(user->pool, struct mail_namespace, 1);
 
        sep = getenv(t_strdup_printf("NAMESPACE_%u_SEP", num));
        type = getenv(t_strdup_printf("NAMESPACE_%u_TYPE", num));
@@ -76,7 +76,7 @@ namespace_add_env(pool_t pool, const char *data, unsigned int num,
 
        if (sep != NULL)
                ns->sep = *sep;
-       ns->prefix = p_strdup(pool, prefix);
+       ns->prefix = p_strdup(user->pool, prefix);
        ns->user = user;
 
        if (mail_storage_create(ns, NULL, data, flags, lock_method,
@@ -178,7 +178,7 @@ namespaces_sort(struct mail_namespace *src)
        return dest;
 }
 
-int mail_namespaces_init(pool_t pool, struct mail_user *user)
+int mail_namespaces_init(struct mail_user *user)
 {
        struct mail_namespace *namespaces, *ns, **ns_p;
        enum mail_storage_flags flags;
@@ -199,7 +199,7 @@ int mail_namespaces_init(pool_t pool, struct mail_user *user)
                        break;
 
                T_BEGIN {
-                       *ns_p = namespace_add_env(pool, data, i, user, flags,
+                       *ns_p = namespace_add_env(data, i, user, flags,
                                                  lock_method);
                } T_END;
 
@@ -232,7 +232,7 @@ int mail_namespaces_init(pool_t pool, struct mail_user *user)
                        mail = t_strconcat("maildir:", mail, NULL);
        }
 
-       ns = p_new(pool, struct mail_namespace, 1);
+       ns = p_new(user->pool, struct mail_namespace, 1);
        ns->type = NAMESPACE_PRIVATE;
        ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST |
                NAMESPACE_FLAG_SUBSCRIPTIONS;
@@ -260,11 +260,11 @@ int mail_namespaces_init(pool_t pool, struct mail_user *user)
 }
 
 struct mail_namespace *
-mail_namespaces_init_empty(pool_t pool, struct mail_user *user)
+mail_namespaces_init_empty(struct mail_user *user)
 {
        struct mail_namespace *ns;
 
-       ns = p_new(pool, struct mail_namespace, 1);
+       ns = p_new(user->pool, struct mail_namespace, 1);
        ns->user = user;
        ns->prefix = "";
        ns->flags = NAMESPACE_FLAG_INBOX | NAMESPACE_FLAG_LIST |
index bcdeae1c6008ff72a7c8e503c93dda8c0420dfa0..2bc7072450296a7a8a9df8acc1ddd51ac36d147f 100644 (file)
@@ -43,9 +43,8 @@ struct mail_namespace {
 /* Called after namespaces has been created */
 extern void (*hook_mail_namespaces_created)(struct mail_namespace *namespaces);
 
-int mail_namespaces_init(pool_t pool, struct mail_user *user);
-struct mail_namespace *
-mail_namespaces_init_empty(pool_t pool, struct mail_user *user);
+int mail_namespaces_init(struct mail_user *user);
+struct mail_namespace *mail_namespaces_init_empty(struct mail_user *user);
 void mail_namespaces_deinit(struct mail_namespace **namespaces);
 
 /* Update hierarchy separators in given name to real_sep characters. */
index e7625251ca94f7467feaffa2a26400ccfb1f476f..a57482abd44368d551e15cfc0ea7c5c715fb5ae0 100644 (file)
@@ -400,7 +400,7 @@ int convert_storage(const char *source_data,
        const char *path, *error;
        int ret;
 
-       source_ns = mail_namespaces_init_empty(pool_datastack_create(), user);
+       source_ns = mail_namespaces_init_empty(user);
        dest_inbox_ns = mail_namespace_find_inbox(dest_namespaces);
        src_flags = dest_inbox_ns->storage->flags;
        lock_method = dest_inbox_ns->storage->lock_method;
index ac62cc1658ea1757aeb60d55aef39e5fd0b9e547..ad88687aeb22a6940398995f1d628c1dc2e47222 100644 (file)
@@ -49,7 +49,7 @@ int main(int argc, const char *argv[])
 
        mail_storage_parse_env(&dest_flags, &lock_method);
        user = mail_user_init(argv[1], argv[2]);
-       dest_ns = mail_namespaces_init_empty(pool_datastack_create(), user);
+       dest_ns = mail_namespaces_init_empty(user);
 
        if (mail_storage_create(dest_ns, NULL, argv[4],
                                dest_flags, lock_method, &error) < 0) {
index 6f23d6f1c1c0373aff63252f3d323c6e1c20d43a..4ad3324ee67b4a67a589b594d28ed42c680660ad 100644 (file)
@@ -27,7 +27,6 @@ struct expire_context {
 
        char *user;
        struct mail_user *mail_user;
-       pool_t namespace_pool;
        bool testrun;
 };
 
@@ -45,7 +44,7 @@ static int user_init(struct expire_context *ctx, const char *user)
        }
 
        ctx->mail_user = mail_user_init(user, getenv("HOME"));
-       if (mail_namespaces_init(ctx->namespace_pool, ctx->mail_user) < 0)
+       if (mail_namespaces_init(ctx->mail_user) < 0)
                return -1;
        return 1;
 }
@@ -54,7 +53,6 @@ static void user_deinit(struct expire_context *ctx)
 {
        mail_user_deinit(&ctx->mail_user);
        i_free_and_null(ctx->user);
-       p_clear(ctx->namespace_pool);
 }
 
 static int
@@ -204,7 +202,6 @@ static void expire_run(bool testrun)
        memset(&ctx, 0, sizeof(ctx));
        ctx.testrun = testrun;
        ctx.auth_conn = auth_connection_init(auth_socket);
-       ctx.namespace_pool = pool_alloconly_create("namespaces", 1024);
        env = expire_env_init(getenv("EXPIRE"), getenv("EXPIRE_ALTMOVE"));
        dict = dict_init(getenv("EXPIRE_DICT"), DICT_DATA_TYPE_UINT32, "");
        if (dict == NULL)
index e25e13d8d20b77e935687e5b479fe2858f6d8cb3..ff9398762a5fcafa9cf5f28aa8041ad38076e5b6 100644 (file)
@@ -41,7 +41,6 @@ struct ioloop *ioloop;
 void (*hook_client_created)(struct client **client) = NULL;
 
 static struct module *modules = NULL;
-static pool_t namespace_pool;
 static char log_prefix[128]; /* syslog() needs this to be permanent */
 static struct io *log_io = NULL;
 
@@ -230,9 +229,8 @@ static bool main_init(void)
                i_fatal("pop3_uidl_format setting doesn't contain any "
                        "%% variables.");
 
-       namespace_pool = pool_alloconly_create("namespaces", 1024);
        user = mail_user_init(getenv("USER"), getenv("HOME"));
-       if (mail_namespaces_init(namespace_pool, user) < 0)
+       if (mail_namespaces_init(user) < 0)
                i_fatal("Namespace initialization failed");
 
        client = client_create(0, 1, user);