From 5b8d97ad575de8eae7f6faa8c1f27241c2ee5ebc Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Mon, 30 Sep 2024 23:47:43 +0200
Subject: [PATCH] lib-sieve: storage: file: sieve-file-storage - Split off
 sieve_file_storage_init_from_settings()

---
 .../storage/file/sieve-file-storage.c         | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/lib-sieve/storage/file/sieve-file-storage.c b/src/lib-sieve/storage/file/sieve-file-storage.c
index 51cc7c4d1..6e814f985 100644
--- a/src/lib-sieve/storage/file/sieve-file-storage.c
+++ b/src/lib-sieve/storage/file/sieve-file-storage.c
@@ -479,11 +479,11 @@ sieve_file_storage_init_common(struct sieve_file_storage *fstorage,
 }
 
 static int
-sieve_file_storage_init(struct sieve_storage *storage,
-			const char *const *options)
+sieve_file_storage_init_from_settings(
+	struct sieve_file_storage *fstorage,
+	const char *const *options)
 {
-	struct sieve_file_storage *fstorage =
-		container_of(storage, struct sieve_file_storage, storage);
+	struct sieve_storage *storage = &fstorage->storage;
 	const char *storage_path = storage->location;
 	const char *value, *active_path = "";
 	bool exists = FALSE;
@@ -575,6 +575,21 @@ sieve_file_storage_init(struct sieve_storage *storage,
 					      storage_path, exists);
 }
 
+static int
+sieve_file_storage_init(struct sieve_storage *storage,
+			const char *const *options)
+{
+	struct sieve_file_storage *fstorage =
+		container_of(storage, struct sieve_file_storage, storage);
+	int ret;
+
+	ret = sieve_file_storage_init_from_settings(fstorage, options);
+	if (ret < 0)
+		return -1;
+
+	return ret;
+}
+
 static void
 sieve_file_storage_autodetect(struct sieve_file_storage *fstorage,
 			      const char **storage_path_r)
-- 
GitLab