summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-05-28 22:17:22 +0000
commita13a7e762ef3dc8ab0824ee1ffac2c9aac6ef5ec (patch)
tree05e0320ae1cb708df822ccf57fee458dacf84036 /sys/arch/macppc
parenta66c971a33649b54c477de18433901a9fa704860 (diff)
avoid bypassing sys/queue.h in many places in the kernel.
many assumptions were made about the way the various list types are implemented. lots of suggestions and help from otto and miod. ok otto@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/stand/alloc.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 370ba80bba2..94a9cc7af08 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.4 2005/09/15 20:42:33 kettenis Exp $ */
+/* $OpenBSD: alloc.c,v 1.5 2007/05/28 22:17:21 pyr Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -114,15 +114,14 @@ alloc(unsigned size)
#ifdef ALLOC_FIRST_FIT
/* scan freelist */
- for (f = freelist.lh_first; f != NULL && f->size < size;
- f = f->list.le_next)
- /* noop */ ;
+ LIST_FOREACH(f, &freelist, list)
+ if (f->size >= size)
+ break;
bestf = f;
failed = (bestf == (struct fl *)0);
#else
/* scan freelist */
- f = freelist.lh_first;
- while (f != NULL) {
+ LIST_FOREACH(f, &freelist, list) {
if (f->size >= size) {
if (f->size == size) /* exact match */
goto found;
@@ -133,7 +132,6 @@ alloc(unsigned size)
bestsize = f->size;
}
}
- f = f->list.le_next;
}
/* no match in freelist if bestsize unchanged */
@@ -201,13 +199,13 @@ freeall()
struct ml *m;
/* Release chunks on freelist... */
- while ((m = freelist.lh_first) != NULL) {
+ while ((m = LIST_FIRST(&freelist)) != NULL) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}
/* ...and allocated list. */
- while ((m = allocatedlist.lh_first) != NULL) {
+ while ((m = LIST_FIRST(&allocated)) != NULL)) {
LIST_REMOVE(m, list);
OF_release(m, m->size);
}