Mercurial > flash_v2
comparison packages/services/memalloc/common/current/include/mvarimpl.inl @ 1687:eb235374a7ae
2004-06-24 Oyvind Harboe <oyvind.harboe@zylin.com>
* Added cyg_memalloc_alloc_fail() fn which is invoked before
return NULL from failed allocations. Useful breakpoint site.
Andrew Lunn wrote some of the code and pointed out various
wrinkles to be ironed out.
| author | asl |
|---|---|
| date | Mon, 05 Jul 2004 11:07:04 +0000 |
| parents | d2c90368aeef |
| children |
comparison
equal
deleted
inserted
replaced
| 1686:961151dc048e | 1687:eb235374a7ae |
|---|---|
| 273 freemem -=size; | 273 freemem -=size; |
| 274 | 274 |
| 275 cyg_uint8 *ptr = memdq2alloc( dq ); | 275 cyg_uint8 *ptr = memdq2alloc( dq ); |
| 276 CYG_ASSERT( ((CYG_ADDRESS)ptr & (alignment-1)) == 0, | 276 CYG_ASSERT( ((CYG_ADDRESS)ptr & (alignment-1)) == 0, |
| 277 "returned memory not aligned" ); | 277 "returned memory not aligned" ); |
| 278 CYG_MEMALLOC_FAIL_TEST(ptr==NULL, size); | |
| 279 | |
| 278 return ptr; | 280 return ptr; |
| 279 } | 281 } |
| 280 | 282 |
| 281 // ------------------------------------------------------------------------- | 283 // ------------------------------------------------------------------------- |
| 282 // resize existing allocation, if oldsize is non-NULL, previous | 284 // resize existing allocation, if oldsize is non-NULL, previous |
| 356 } // if | 358 } // if |
| 357 else if ( newsize == dq->size ) { | 359 else if ( newsize == dq->size ) { |
| 358 ret = alloc_ptr; | 360 ret = alloc_ptr; |
| 359 } | 361 } |
| 360 | 362 |
| 363 CYG_MEMALLOC_FAIL_TEST(ret==NULL, newsize); | |
| 364 | |
| 361 return ret; | 365 return ret; |
| 362 | 366 |
| 363 } // resize_alloc() | 367 } // resize_alloc() |
| 364 | 368 |
| 365 | 369 |
