Main goto loop to for loop

Thanks to quinq http://lists.suckless.org/hackers/1609/12073.html
This commit is contained in:
Ivan Tham 2016-09-06 21:36:05 +08:00
parent aa718fd83a
commit 906a6caa13

13
spt.c
View File

@ -129,14 +129,11 @@ main(int argc, char *argv[])
if (signal(SIGUSR2, SIG_IGN) != SIG_IGN) if (signal(SIGUSR2, SIG_IGN) != SIG_IGN)
signal(SIGUSR2, toggle); signal(SIGUSR2, toggle);
run: for (i = 0; ; i = (i + 1) % LEN(timers)) {
notify_send(timers[i].cmt); notify_send(timers[i].cmt);
for (timecount = 0; timecount < timers[i].tmr; timecount += inc)
for (timecount = 0; timecount < timers[i].tmr; timecount += inc) sleep(1);
sleep(1); }
if (++i >= LEN(timers)) i = 0; /* i infinal loop */
goto run;
return 0; return 0;
} }