]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail_storage_create() - Remove unused driver parameter
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 2 Nov 2023 11:09:07 +0000 (13:09 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
src/lib-storage/index/raw/raw-storage.c
src/lib-storage/index/shared/shared-storage.c
src/lib-storage/mail-namespace.c
src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h

index 92d5b7c08044299b504080746134dbcb60d043f7..aa74774e5ca3d88cf4b57c7861474b9d4cd6ae9c 100644 (file)
@@ -73,7 +73,7 @@ raw_storage_create_from_set(struct mail_storage_service_ctx *ctx,
        ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
        ns->set = ns_set;
 
-       if (mail_storage_create(ns, NULL, 0, &error) < 0)
+       if (mail_storage_create(ns, 0, &error) < 0)
                i_fatal("Couldn't create internal raw storage: %s", error);
        if (mail_namespaces_init_finish(ns, &error) < 0)
                i_fatal("Couldn't create internal raw namespace: %s", error);
index 2276e86892803d9d27af4d1ffaa6482335f44033..430b8a6415401a7017fb148649ad3e919243359e 100644 (file)
@@ -391,7 +391,7 @@ shared_mail_user_init(struct mail_storage *_storage,
        new_storage_flags = _storage->flags &
                ENUM_NEGATE(MAIL_STORAGE_FLAG_SHARED_DYNAMIC);
        new_storage_flags |= MAIL_STORAGE_FLAG_NO_AUTOVERIFY;
-       if (mail_storage_create(new_ns, NULL, new_storage_flags, &error) < 0) {
+       if (mail_storage_create(new_ns, new_storage_flags, &error) < 0) {
                mailbox_list_set_critical(ns->list, "Namespace %s: %s",
                                          new_ns->prefix, error);
                /* owner gets freed by namespace deinit */
index 464bd95444914b94df896f900c74892dd02aa806..72241ba674c8a3280f2834ddbf065d3ac4e1f42f 100644 (file)
@@ -174,7 +174,7 @@ int mail_namespaces_init_add(struct mail_user *user,
                ns->flags |= NAMESPACE_FLAG_NOQUOTA | NAMESPACE_FLAG_NOACL;
        }
 
-       if (mail_storage_create(ns, NULL, flags, &error) < 0) {
+       if (mail_storage_create(ns, flags, &error) < 0) {
                *error_r = t_strdup_printf("Namespace %s: %s",
                                           ns->set->name, error);
                mail_namespace_free(ns);
@@ -510,7 +510,7 @@ mail_namespaces_init_location_full(struct mail_user *user, const char *location,
        if ((ret = mail_namespace_alloc(user, inbox_set, &ns, error_r)) < 0)
                return ret;
 
-       if (mail_storage_create(ns, NULL, 0, error_r) < 0) {
+       if (mail_storage_create(ns, 0, error_r) < 0) {
                mail_namespace_free(ns);
                return -1;
        }
index 96c394cb9bc1dcddf8599c964550363b0e9cfaf6..5d8721cfd061d4ac15dca59b8bc5c762a824187d 100644 (file)
@@ -345,7 +345,7 @@ mail_storage_find(struct mail_user *user,
 }
 
 static int
-mail_storage_create_full_real(struct mail_namespace *ns, const char *driver,
+mail_storage_create_full_real(struct mail_namespace *ns,
                              const char *data, enum mail_storage_flags flags,
                              struct mail_storage **storage_r,
                              const char **error_r)
@@ -354,7 +354,7 @@ mail_storage_create_full_real(struct mail_namespace *ns, const char *driver,
        struct mailbox_list *list;
        struct mailbox_list_settings list_set;
        enum mailbox_list_flags list_flags = 0;
-       const char *p;
+       const char *p, *driver = NULL;
 
        mailbox_list_settings_init_defaults(&list_set);
        if ((flags & MAIL_STORAGE_FLAG_SHARED_DYNAMIC) != 0) {
@@ -362,8 +362,7 @@ mail_storage_create_full_real(struct mail_namespace *ns, const char *driver,
                list_set.root_dir = ns->user->set->base_dir;
                driver = MAIL_SHARED_STORAGE_NAME;
        } else {
-               if (driver == NULL)
-                       mail_storage_set_autodetection(&data, &driver);
+               mail_storage_set_autodetection(&data, &driver);
                if (mailbox_list_settings_parse(ns->user, data, &list_set,
                                                error_r) < 0)
                        return -1;
@@ -501,15 +500,14 @@ mail_storage_create_full_real(struct mail_namespace *ns, const char *driver,
        return 0;
 }
 
-int mail_storage_create(struct mail_namespace *ns, const char *driver,
+int mail_storage_create(struct mail_namespace *ns,
                        enum mail_storage_flags flags, const char **error_r)
 {
        struct mail_storage *storage;
        int ret;
        T_BEGIN {
-               ret = mail_storage_create_full_real(ns, driver,
-                                                   ns->set->location, flags,
-                                                   &storage, error_r);
+               ret = mail_storage_create_full_real(ns, ns->set->location,
+                                                   flags, &storage, error_r);
        } T_END_PASS_STR_IF(ret < 0, error_r);
        return ret;
 }
index 56155dcb1c16a9fa06727009b9f971aa1bb320a8..019c6cf2d6d226f4a57d965b8b22dbd1b9c517c9 100644 (file)
@@ -489,13 +489,9 @@ void mail_storage_class_unregister(struct mail_storage *storage_class);
 /* Find mail storage class by name */
 struct mail_storage *mail_storage_find_class(const char *name);
 
-/* Create a new instance of registered mail storage class with given
-   storage-specific data. If driver is NULL, it's tried to be autodetected
-   from ns location. If ns location is NULL, it uses the first storage that
-   exists. The storage is put into ns->storage. */
-int mail_storage_create(struct mail_namespace *ns, const char *driver,
-                       enum mail_storage_flags flags, const char **error_r)
-       ATTR_NULL(2);
+/* Create a storage for the namespace. */
+int mail_storage_create(struct mail_namespace *ns,
+                       enum mail_storage_flags flags, const char **error_r);
 void mail_storage_unref(struct mail_storage **storage);
 
 /* Returns the mail storage settings. */