From 9867bdb111f827e8e6f43e1c1111bb513811f3f1 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Mon, 28 Feb 2022 08:54:47 -0500 Subject: [PATCH] connection: Small simplification to wl_connection_write() wl_connection_write() contained an exact copy of the logic in wl_connection_queue(). Simplify things by just calling wl_connection_queue() from wl_connection_write(). Signed-off-by: John Lindgren --- src/connection.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/connection.c b/src/connection.c index f2e5837f..bcee87e2 100644 --- a/src/connection.c +++ b/src/connection.c @@ -382,14 +382,7 @@ int wl_connection_write(struct wl_connection *connection, const void *data, size_t count) { - if (connection->out.head - connection->out.tail + - count > ARRAY_LENGTH(connection->out.data)) { - connection->want_flush = 1; - if (wl_connection_flush(connection) < 0) - return -1; - } - - if (ring_buffer_put(&connection->out, data, count) < 0) + if (wl_connection_queue(connection, data, count) < 0) return -1; connection->want_flush = 1;