92,17 → 92,22 |
{ |
int rc; |
void *res; |
|
/* Check for invalid values */ |
if (incr < 0 && -incr > heapsize) |
return NULL; |
|
/* Check for too large value */ |
if (incr > 0 && incr+heapsize < heapsize) |
return NULL; |
|
/* Check for too small values */ |
if (incr < 0 && incr+heapsize > heapsize) |
return NULL; |
|
/* Check for user limit */ |
if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL; |
if ((maxheapsize != (size_t) (-1)) && (heapsize + incr) > maxheapsize) |
return NULL; |
|
rc = as_area_resize(&_heap, heapsize + incr,0); |
if (rc != 0) |
121,7 → 126,7 |
{ |
maxheapsize=mhs; |
/* Return pointer to area not managed by sbrk */ |
return (void *)&_heap + maxheapsize; |
return ((void *) &_heap + maxheapsize); |
|
} |
|
137,8 → 142,9 |
/* Set heapsize to some meaningful value */ |
if (maxheapsize == -1) |
set_maxheapsize(ALIGN_UP(USER_ADDRESS_SPACE_SIZE_ARCH>>1,PAGE_SIZE)); |
|
if (!last_allocated) |
last_allocated = ALIGN_UP((void *)&_heap + maxheapsize, PAGE_SIZE); |
last_allocated = (void *) ALIGN_UP((void *) &_heap + maxheapsize, PAGE_SIZE); |
|
sz = ALIGN_UP(sz, PAGE_SIZE); |
res = last_allocated; |
147,8 → 153,5 |
return res; |
} |
|
|
/** @} |
*/ |
|
|