]> git.ozlabs.org Git - ccan/blobdiff - ccan/timer/test/run.c
timer: change timers_expire() to return a single timer.
[ccan] / ccan / timer / test / run.c
index cebc99ce7e5f69544ce89c7f4dedebfa677ea170..f7b711f2c8530cb98183baf10ed07770f3fc4264 100644 (file)
@@ -13,7 +13,6 @@ int main(void)
 {
        struct timers timers;
        struct timer t[64];
-       struct list_head expired;
        struct timeabs earliest;
        uint64_t i;
        struct timeabs epoch = { { 0, 0 } };
@@ -69,13 +68,11 @@ int main(void)
                struct timer *t1, *t2;
 
                ok1(timer_earliest(&timers, &earliest));
-               timers_expire(&timers, earliest, &expired);
-
-               t1 = list_pop(&expired, struct timer, list);
+               t1 = timers_expire(&timers, earliest);
                ok1(t1);
-               t2 = list_pop(&expired, struct timer, list);
+               t2 = timers_expire(&timers, earliest);
                ok1(t2);
-               ok1(list_empty(&expired));
+               ok1(!timers_expire(&timers, earliest));
 
                ok1(t1 == &t[i*2] || t1 == &t[i*2+1]);
                ok1(t2 != t1 && (t2 == &t[i*2] || t2 == &t[i*2+1]));