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>
This commit is contained in:
meltq 2024-06-30 22:36:11 +05:30 committed by Tejas Vipin
parent fa1811ce3e
commit 0cecde304f
5 changed files with 36 additions and 16 deletions

View file

@ -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;