From aa718fd83ad84e357a1235b7bd037385dcdc23ff Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Fri, 5 Aug 2016 17:54:38 +0800 Subject: [PATCH] Fix logic for i infinal loop thanks to this I had learned about dprintf and breakpoints --- spt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spt.c b/spt.c index 922f310..abbcc47 100644 --- a/spt.c +++ b/spt.c @@ -135,7 +135,7 @@ run: for (timecount = 0; timecount < timers[i].tmr; timecount += inc) sleep(1); - i = (i < LEN(timers)) ? i+1 : 0; /* i infinal loop */ + if (++i >= LEN(timers)) i = 0; /* i infinal loop */ goto run; return 0;