From a46d89de9aaad325ea908a39a1a58edfabc95918 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Thu, 13 Apr 2017 11:51:51 -0500 Subject: [PATCH] connection: Use wl_buffer_size() for all buffer size calculations There were two places where we did the same calculation manually. Signed-off-by: Derek Foreman Reviewed-by: Daniel Stone --- src/connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/connection.c b/src/connection.c index 7fe35b5e..e60ad75f 100644 --- a/src/connection.c +++ b/src/connection.c @@ -178,7 +178,7 @@ close_fds(struct wl_buffer *buffer, int max) int32_t fds[sizeof(buffer->data) / sizeof(int32_t)], i, count; size_t size; - size = buffer->head - buffer->tail; + size = wl_buffer_size(buffer); if (size == 0) return; @@ -222,7 +222,7 @@ build_cmsg(struct wl_buffer *buffer, char *data, int *clen) struct cmsghdr *cmsg; size_t size; - size = buffer->head - buffer->tail; + size = wl_buffer_size(buffer); if (size > MAX_FDS_OUT * sizeof(int32_t)) size = MAX_FDS_OUT * sizeof(int32_t);