diff options
Diffstat (limited to 'sys/arch/sparc64/stand/ofwboot')
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/alloc.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/vers.c | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/alloc.c b/sys/arch/sparc64/stand/ofwboot/alloc.c index 7c999b9711d..c20643c3acb 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.9 2016/03/14 23:08:05 krw Exp $ */ +/* $OpenBSD: alloc.c,v 1.10 2024/11/05 14:49:52 miod Exp $ */ /* $NetBSD: alloc.c,v 1.1 2000/08/20 14:58:37 mrg Exp $ */ /* @@ -94,8 +94,10 @@ LIST_HEAD(, ml) allocatedlist = LIST_HEAD_INITIALIZER(allocatedlist); void * alloc(unsigned size) { - struct ml *f, *bestf; + struct ml *f, *bestf = NULL; +#ifndef ALLOC_FIRST_FIT unsigned bestsize = 0xffffffff; /* greater than any real size */ +#endif char *help; int failed; @@ -132,7 +134,7 @@ alloc(unsigned size) } /* no match in freelist if bestsize unchanged */ - failed = (bestsize == 0xffffffff); + failed = (bestsize == 0xffffffff || bestsize >= size * 2); #endif if (failed) { /* nothing found */ @@ -157,7 +159,9 @@ alloc(unsigned size) /* we take the best fit */ f = bestf; +#ifndef ALLOC_FIRST_FIT found: +#endif /* remove from freelist */ LIST_REMOVE(f, list); help = (char *)f; diff --git a/sys/arch/sparc64/stand/ofwboot/vers.c b/sys/arch/sparc64/stand/ofwboot/vers.c index a5f408eeb10..0137fbc74dd 100644 --- a/sys/arch/sparc64/stand/ofwboot/vers.c +++ b/sys/arch/sparc64/stand/ofwboot/vers.c @@ -1 +1 @@ -const char version[] = "1.28"; +const char version[] = "1.29"; |