diff options
author | Marvin Borner | 2020-09-15 19:17:49 +0200 |
---|---|---|
committer | Marvin Borner | 2020-09-15 19:17:49 +0200 |
commit | 1a99700287749211aec38cb58ea2664585154794 (patch) | |
tree | db2146945c4d2fcb5a9506aaa65ff3f0e1d48a53 /kernel/features/proc.c | |
parent | c04947731537a722b7efe94ea0d7e56cbf21bf57 (diff) |
Some code improvements.
I know, my commit messages are getting worse...
Diffstat (limited to 'kernel/features/proc.c')
-rw-r--r-- | kernel/features/proc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/features/proc.c b/kernel/features/proc.c index aab4fec..3f8dcf1 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -111,10 +111,11 @@ struct proc_message *proc_receive(struct proc *proc) struct proc *proc_from_pid(u32 pid) { struct node *iterator = proc_list->head; - do { + while (iterator != NULL) { if (((struct proc *)iterator->data)->pid == pid) return iterator->data; - } while ((iterator = iterator->next) != NULL); + iterator = iterator->next; + } return NULL; } @@ -124,13 +125,14 @@ void proc_exit(struct proc *proc, int status) int res = 0; struct node *iterator = proc_list->head; - do { + while (iterator != NULL) { if (iterator->data == proc) { res = 1; list_remove(proc_list, iterator); break; } - } while ((iterator = iterator->next) != NULL); + iterator = iterator->next; + } if (memcmp(proc, current->data, sizeof(*proc)) == 0) current = NULL; |