X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/ff3b058ac51e9caf5cf1fd310b8a401a97a85582..18006b5cc4b0c4b72c638669a6ad5c8fb39ddf87:/src/timeq.c diff --git a/src/timeq.c b/src/timeq.c index 064d2d7..c00b165 100644 --- a/src/timeq.c +++ b/src/timeq.c @@ -35,10 +35,9 @@ timeq_cleanup(void) { timeq_del(0, 0, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_FUNC|TIMEQ_IGNORE_DATA); heap_delete(timeq); - timeq = NULL; } -static void +void timeq_init(void) { timeq = heap_new(int_comparator); @@ -49,8 +48,6 @@ time_t timeq_next(void) { void *time; - if (!timeq) - return ~0; heap_peek(timeq, &time, 0); return (time_t)time; } @@ -65,8 +62,6 @@ timeq_add_real(time_t when, timeq_func func, void *data, UNUSED_ARG(const char * ent->func = func; ent->data = data; w = (void*)when; - if (!timeq) - timeq_init(); heap_insert(timeq, w, ent); } @@ -102,7 +97,6 @@ timeq_del_real(time_t when, timeq_func func, void *data, int mask, UNUSED_ARG(co extra.func = func; extra.data = data; extra.mask = mask; - if (timeq) heap_remove_pred(timeq, timeq_del_matching, &extra); }