Pull cleanup fixes from sys/arch/shark/stand/ofwboot/alloc.c.

These files are now almost identical.
This commit is contained in:
uwe 2006-01-27 02:39:07 +00:00
parent fe55d8a997
commit 967fd50006

View File

@ -1,4 +1,4 @@
/* $NetBSD: alloc.c,v 1.7 2006/01/25 18:28:27 christos Exp $ */
/* $NetBSD: alloc.c,v 1.8 2006/01/27 02:39:07 uwe Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -129,7 +129,9 @@ void *
alloc(size_t size)
{
struct ml *f, *bestf;
#ifndef ALLOC_FIRST_FIT
unsigned bestsize = 0xffffffff; /* greater than any real size */
#endif
char *help;
int failed;
@ -149,9 +151,10 @@ alloc(size_t size)
f = f->list.le_next)
/* noop */ ;
bestf = f;
failed = (bestf == (struct fl *)0);
failed = (bestf == NULL);
#else
/* scan freelist */
bestf = NULL; /* XXXGCC: -Wuninitialized */
f = freelist.lh_first;
while (f != NULL) {
if ((size_t)f->size >= size) {
@ -177,7 +180,7 @@ alloc(size_t size)
* to page size, and record the chunk size.
*/
size = roundup(size, NBPG);
help = OF_claim(0, (unsigned)size, NBPG);
help = OF_claim(NULL, (unsigned)size, NBPG);
if (help == (char *)-1)
panic("alloc: out of memory");
@ -193,7 +196,9 @@ alloc(size_t size)
/* we take the best fit */
f = bestf;
#ifndef ALLOC_FIRST_FIT
found:
#endif
/* remove from freelist */
LIST_REMOVE(f, list);
help = (char *)f;