]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: convert shared to use container_of
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Mon, 28 Aug 2017 08:52:06 +0000 (11:52 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Thu, 7 Sep 2017 07:43:55 +0000 (10:43 +0300)
src/lib-storage/index/shared/shared-storage.c
src/lib-storage/index/shared/shared-storage.h

index 8b66e344c31e71015ec9f7c68d6d19e95e86d55b..ae88cdffbf719ecef6a27658e0ffeffb520fe85b 100644 (file)
@@ -31,7 +31,7 @@ static int
 shared_storage_create(struct mail_storage *_storage, struct mail_namespace *ns,
                      const char **error_r)
 {
-       struct shared_storage *storage = (struct shared_storage *)_storage;
+       struct shared_storage *storage = SHARED_STORAGE(_storage);
        struct mail_storage *storage_class;
        const char *driver, *p;
        char *wildcardp, key;
@@ -138,7 +138,7 @@ int shared_storage_get_namespace(struct mail_namespace **_ns,
 {
        struct mail_storage *_storage = (*_ns)->storage;
        struct mailbox_list *list = (*_ns)->list;
-       struct shared_storage *storage = (struct shared_storage *)_storage;
+       struct shared_storage *storage = SHARED_STORAGE(_storage);
        struct mail_user *user = _storage->user;
        struct mail_namespace *new_ns, *ns = *_ns;
        struct mail_namespace_settings *ns_set, *unexpanded_ns_set;
index 4a533372cfd07d9de215cd83c7eef9023911ab00..5463b1c54812992337d0e90dbd3930e34492aa7c 100644 (file)
@@ -11,6 +11,8 @@ struct shared_storage {
        const char *storage_class_name;
 };
 
+#define SHARED_STORAGE(s)      container_of(s, struct shared_storage, storage)
+
 struct mailbox_list *shared_mailbox_list_alloc(void);
 
 /* Returns -1 = error, 0 = user doesn't exist, 1 = ok */