From 58bb6c721126c12ab644bee557bef6825562440a Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 16 Jul 2024 06:31:13 -0500 Subject: [PATCH] src: Finish assert() clean-up From cleanup commit 0cecde304: assert()s can be compiled away by #defining NDEBUG. Some build systems do this. Using wl_abort gives a human readable error message and it isn't compiled away. That commit missed one final assert, presumably due to missing it with grep because of a coding style issue. Fix that up, and remove inclusion of as appropriate. Signed-off-by: Derek Foreman --- cursor/convert_font.c | 1 - src/connection.c | 1 - src/event-loop.c | 1 - src/wayland-client.c | 1 - src/wayland-server.c | 4 ++-- src/wayland-shm.c | 1 - 6 files changed, 2 insertions(+), 7 deletions(-) diff --git a/cursor/convert_font.c b/cursor/convert_font.c index 74e45fbc..77e34c20 100644 --- a/cursor/convert_font.c +++ b/cursor/convert_font.c @@ -29,7 +29,6 @@ * http://fontforge.org/pcf-format.html */ -#include #include #include #include diff --git a/src/connection.c b/src/connection.c index fb6a4be8..e1b751ac 100644 --- a/src/connection.c +++ b/src/connection.c @@ -26,7 +26,6 @@ #define _GNU_SOURCE -#include #include #include #include diff --git a/src/event-loop.c b/src/event-loop.c index f6392521..51c9b9d0 100644 --- a/src/event-loop.c +++ b/src/event-loop.c @@ -23,7 +23,6 @@ * SOFTWARE. */ -#include #include #include #include diff --git a/src/wayland-client.c b/src/wayland-client.c index a2c9ad95..f7d38d4b 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/src/wayland-server.c b/src/wayland-server.c index 5ea9101b..1d6be3ec 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -1534,7 +1533,8 @@ wl_display_terminate(struct wl_display *display) display->run = false; ret = write(display->terminate_efd, &terminate, sizeof(terminate)); - assert (ret >= 0 || errno == EAGAIN); + if (ret < 0 && errno != EAGAIN) + wl_abort("Write failed at shutdown\n"); } WL_EXPORT void diff --git a/src/wayland-shm.c b/src/wayland-shm.c index 70685e6c..87917dad 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include