[PATCH v2 wayland 09/11] connection: Use wl_buffer_size() for all buffer size calculations
Derek Foreman
derekf at osg.samsung.com
Thu Apr 13 16:51:51 UTC 2017
There were two places where we did the same calculation manually.
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
src/connection.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index 2bfdd82..bd66e94 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;
@@ -228,7 +228,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);
--
2.11.0
More information about the wayland-devel
mailing list