From 8c9020eec27a8d3335a5e841aa54530cae95da4b Mon Sep 17 00:00:00 2001 From: randomuser Date: Thu, 10 Nov 2022 20:51:19 +0000 Subject: [PATCH] slim down timer --- c/timer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/c/timer.c b/c/timer.c index 3f19fd0..256570a 100644 --- a/c/timer.c +++ b/c/timer.c @@ -32,12 +32,12 @@ struct settings { .s = 0 }; -void timerdec(struct timer *t) { if (t->s != 0) t->s--; } +void timerdec(struct timer *t) { if (t->s) t->s--; } void timerinc(struct timer *t) { t->s++; } -void timerupdate(struct timer *t) { if(t->u != NULL) t->u(t); } +void timerupdate(struct timer *t) { if(t->u) t->u(t); } int timerstate(int (*f)(struct timer *t), struct timer *t) { - if(f != NULL) { + if(f) { if(f(t)) return 1; else return 0; } @@ -48,7 +48,7 @@ int timerstop(struct timer *t) { return timerstate(t->c, t); } int timerpause(struct timer *t) { return timerstate(t->p, t); } int timerzero(struct timer *t) { - if(t->s == 0) return 1; + if(!t->s) return 1; return 0; } @@ -68,13 +68,13 @@ struct timer *timerinit(void) { } int timerissettings(struct timer *t) { - if(t->s == 0) return 0; + if(!t->s) return 0; if(s.s == t->s) return 1; return 0; } int tomatotimer(struct timer *t) { - if(t->s != 0) return 0; + if(t->s) return 0; if(t->d % 2) t->s = s.s / 2; else t->s = s.s; t->d++;