]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: ostream-dot.c - Use container_of macro
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 16 Dec 2025 15:12:13 +0000 (17:12 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 6 Feb 2026 13:08:57 +0000 (13:08 +0000)
src/lib-mail/ostream-dot.c

index f5bfa72e20be173e959ad16e060507203d8eca77..2359804c71caf8bfc0799c04bd126bdcfd25c02b 100644 (file)
@@ -22,7 +22,8 @@ struct dot_ostream {
 
 static int o_stream_dot_finish(struct ostream_private *stream)
 {
-       struct dot_ostream *dstream = (struct dot_ostream *)stream;
+       struct dot_ostream *dstream =
+               container_of(stream, struct dot_ostream, ostream);
        int ret;
 
        if (dstream->state == STREAM_STATE_DONE)
@@ -65,7 +66,10 @@ o_stream_dot_flush(struct ostream_private *stream)
 static void
 o_stream_dot_close(struct iostream_private *stream, bool close_parent)
 {
-       struct dot_ostream *dstream = (struct dot_ostream *)stream;
+       struct ostream_private *ostream =
+               container_of(stream, struct ostream_private, iostream);
+       struct dot_ostream *dstream =
+               container_of(ostream, struct dot_ostream, ostream);
 
        if (close_parent)
                o_stream_close(dstream->ostream.parent);
@@ -75,7 +79,8 @@ static ssize_t
 o_stream_dot_sendv(struct ostream_private *stream,
                    const struct const_iovec *iov, unsigned int iov_count)
 {
-       struct dot_ostream *dstream = (struct dot_ostream *)stream;
+       struct dot_ostream *dstream =
+               container_of(stream, struct dot_ostream, ostream);
        ARRAY(struct const_iovec) iov_arr;
        const struct const_iovec *iov_new;
        size_t max_bytes, sent, added;