ref: 6929f0a986a919aa1280ae8e79745d475f5b770c
parent: 8ebe3f680e9f343a13bfcaaa2e17745b701ec0c8
author: cinap_lenrek <[email protected]>
date: Thu Jan 2 21:16:18 EST 2014
kernel: simplify procalarm()
--- a/sys/src/9/port/alarm.c
+++ b/sys/src/9/port/alarm.c
@@ -83,24 +83,15 @@
}
l = &f->palarm;
}
-
- up->palarm = 0;
- if(alarms.head) {
- l = &alarms.head;
- for(f = *l; f; f = f->palarm) {
- time = f->alarm;
- if(time != 0 && (long)(time - when) >= 0) {
- up->palarm = f;
- *l = up;
- goto done;
- }
- l = &f->palarm;
- }
- *l = up;
+ l = &alarms.head;
+ for(f = *l; f; f = f->palarm) {
+ time = f->alarm;
+ if(time != 0 && (long)(time - when) >= 0)
+ break;
+ l = &f->palarm;
}
- else
- alarms.head = up;
-done:
+ up->palarm = f;
+ *l = up;
up->alarm = when;
qunlock(&alarms);