]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Remove o_stream_nflush()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 27 Oct 2017 21:59:57 +0000 (00:59 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 30 Oct 2017 11:04:53 +0000 (13:04 +0200)
None of its previous callers were calling it correctly, so it's better to
remove it entirely to avoid more of such wrong calls.

src/lib/ostream.c
src/lib/ostream.h

index d9004eb11b069c79610490f0fc2eca0f24204019..4ea970c58c6e6ad90f6cdde22c509fadf9d668b3 100644 (file)
@@ -315,17 +315,9 @@ void o_stream_nsend_str(struct ostream *stream, const char *str)
        o_stream_nsend(stream, str, strlen(str));
 }
 
-void o_stream_nflush(struct ostream *stream)
-{
-       if (unlikely(stream->closed || stream->stream_errno != 0))
-               return;
-       (void)o_stream_flush(stream);
-       stream->real_stream->last_errors_not_checked = TRUE;
-}
-
 int o_stream_nfinish(struct ostream *stream)
 {
-       o_stream_nflush(stream);
+       (void)o_stream_flush(stream);
        o_stream_ignore_last_errors(stream);
        if (stream->stream_errno == 0 && stream->real_stream->noverflow) {
                io_stream_set_error(&stream->real_stream->iostream,
@@ -502,7 +494,9 @@ static void o_stream_default_cork(struct ostream_private *_stream, bool set)
                if (_stream->parent != NULL)
                        o_stream_cork(_stream->parent);
        } else {
-               o_stream_nflush(&_stream->ostream);
+               (void)o_stream_flush(&_stream->ostream);
+               _stream->last_errors_not_checked = TRUE;
+
                if (_stream->parent != NULL)
                        o_stream_uncork(_stream->parent);
        }
index 248add86b532babed12b75cafd3b3362b6098c27..e0f4c50e9f97764b6d39da00bc6127f03d757807 100644 (file)
@@ -121,7 +121,7 @@ size_t o_stream_get_max_buffer_size(struct ostream *stream);
 /* Delays sending as far as possible, writing only full buffers. Also sets
    TCP_CORK on if supported. */
 void o_stream_cork(struct ostream *stream);
-/* Try to flush the buffer by calling o_stream_nflush() and remove TCP_CORK.
+/* Try to flush the buffer by calling o_stream_flush() and remove TCP_CORK.
    Note that after this o_stream_nfinish() must be called, unless the stream
    ignores errors. */
 void o_stream_uncork(struct ostream *stream);
@@ -154,7 +154,6 @@ void o_stream_nsend(struct ostream *stream, const void *data, size_t size);
 void o_stream_nsendv(struct ostream *stream, const struct const_iovec *iov,
                     unsigned int iov_count);
 void o_stream_nsend_str(struct ostream *stream, const char *str);
-void o_stream_nflush(struct ostream *stream);
 /* Marks the stream's error handling as completed. Flushes the stream and
    returns -1 if stream->stream_errno is non-zero. Returns failure if any of
    the o_stream_nsend*() didn't write all data. */