aboutsummaryrefslogtreecommitdiffstats
path: root/src/event-loop.c
diff options
context:
space:
mode:
authormeltq <tejasvipin76@gmail.com>2024-06-30 22:36:11 +0530
committerTejas Vipin <tejasvipin76@gmail.com>2024-07-11 17:44:04 +0000
commit0cecde304f4f78b439d2edaaab6d9b543b30a5c0 (patch)
tree6619eae3a6e4106550b90995fa45d23b3fba3b15 /src/event-loop.c
parenttests: add enum bitfield test (diff)
downloadwayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar.gz
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar.bz2
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar.lz
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar.xz
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.tar.zst
wayland-0cecde304f4f78b439d2edaaab6d9b543b30a5c0.zip
src: switch asserts to wl_abort
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. This commit closes issue #230. Signed-off-by: meltq <tejasvipin76@gmail.com>
Diffstat (limited to 'src/event-loop.c')
-rw-r--r--src/event-loop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/event-loop.c b/src/event-loop.c
index 45222f7..f639252 100644
--- a/src/event-loop.c
+++ b/src/event-loop.c
@@ -447,7 +447,8 @@ wl_timer_heap_disarm(struct wl_timer_heap *timers,
struct wl_event_source_timer *last_end_evt;
int old_source_idx;
- assert(source->heap_idx >= 0);
+ if (!(source->heap_idx >= 0))
+ wl_abort("Timer has already been disarmed\n");
old_source_idx = source->heap_idx;
source->heap_idx = -1;
@@ -476,7 +477,8 @@ wl_timer_heap_arm(struct wl_timer_heap *timers,
struct wl_event_source_timer *source,
struct timespec deadline)
{
- assert(source->heap_idx == -1);
+ if (!(source->heap_idx == -1))
+ wl_abort("Timer is already armed\n");
source->deadline = deadline;
timers->data[timers->active] = source;