diff options
Diffstat (limited to 'sys/arch/sparc64/stand/ofwboot/alloc.c')
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/alloc.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c index 7fd70b4e2a0..84852829d83 100644 --- a/sys/arch/sparc64/stand/ofwboot/alloc.c +++ b/sys/arch/sparc64/stand/ofwboot/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.3 2002/03/14 03:16:01 millert Exp $ */ +/* $OpenBSD: alloc.c,v 1.4 2007/05/28 22:17:21 pyr Exp $ */ /* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */ /* @@ -112,15 +112,14 @@ alloc(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; @@ -131,7 +130,6 @@ alloc(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 = TAILQ_FIRST(&freelist)) != NULL)) { LIST_REMOVE(m, list); OF_release(m, m->size); } /* ...and allocated list. */ - while ((m = allocatedlist.lh_first) != NULL) { + while ((m = TAILQ_FIRST(&allocatedlist)) != NULL)) { LIST_REMOVE(m, list); OF_release(m, m->size); } |