9 /* FIXME: This is not ideal, since we do a get_mem_info() call for
15 static char *heap_ptr
= _end
;
16 static char *heap_start
= _end
;
23 unsigned int avail
= 0;
25 /* The sizeof (s_mem.size) must be 4 bytes. The compiler should be
26 able to eliminate this check */
27 if (sizeof (unsigned int) != 4)
31 /* NOTE: The value returned from the get_mem_info call is the amount
32 of memory, and not the address of the (last byte + 1) */
34 if (((size_t)heap_ptr
>= heap_start
) && ((size_t)heap_ptr
< (heap_start
+ mem
.size
))) {
35 avail
= (heap_start
+ mem
.size
) - (size_t)heap_ptr
;
37 } /* else will fail since "nbytes" will be greater than zeroed "avail" value */
39 if ((nbytes
> avail
) || (heap_ptr
+ nbytes
< _end
))