Mercurial > wgsdk
diff src/timer.c @ 9:07f0e2f43204
*: add the restrict keyword when necessary
also fixed some typos in the README
author | Paper |
---|---|
date | Fri, 16 Dec 2022 21:55:37 -0500 |
parents | be4835547dd0 |
children | 42ac054c0231 |
line wrap: on
line diff
--- a/src/timer.c Fri Dec 16 20:46:33 2022 -0500 +++ b/src/timer.c Fri Dec 16 21:55:37 2022 -0500 @@ -5,29 +5,28 @@ #include <windows.h> #include "timer.h" -void timer_init(struct timer* timer, HWND winampClientWindow, TIMERPROC timer_proc) { +void timer_init(struct timer* restrict timer, HWND winampClientWindow, TIMERPROC timer_proc) { timer->winampClientWindow = winampClientWindow; timer->timer_proc = timer_proc; timer->initialized = 1; } -void timer_set(struct timer* timer, HWND winampClientWindow) { +void timer_set(struct timer* restrict timer, HWND winampClientWindow) { assert(timer->initialized); - + if (timer->is_timer_alive) return; - + timer->is_timer_alive = 1; SetTimer(winampClientWindow, 1, timer->interval, timer->timer_proc); } -void timer_stop(struct timer* timer, HWND winampClientWindow) { +void timer_stop(struct timer* restrict timer, HWND winampClientWindow) { assert(timer->initialized); - + if (!timer->is_timer_alive) return; - - + timer->is_timer_alive = 0; KillTimer(winampClientWindow, 1); } \ No newline at end of file