Ignore:
Timestamp:
Feb 21, 2007 12:40:05 AM (17 years ago)
Author:
bennylp
Message:

Merged the ICE branch into the trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/pool.h

    r974 r992  
    442442 * 
    443443 * @return pointer to the allocated memory. 
     444 * 
     445 * @see PJ_POOL_ALLOC_TYPE 
    444446 */ 
    445447PJ_IDECL(void*) pj_pool_alloc( pj_pool_t *pool, pj_size_t size); 
     
    461463 
    462464/** 
    463  * @def pj_pool_zalloc(pj_pool_t *pool, pj_size_t size) 
    464465 * Allocate storage from the pool and initialize it to zero. 
    465466 * 
     
    468469 * 
    469470 * @return          Pointer to the allocated memory. 
    470  */ 
    471 #define pj_pool_zalloc(pool, size)  pj_pool_calloc(pool, 1, size) 
     471 * 
     472 * @see PJ_POOL_ZALLOC_TYPE 
     473 */ 
     474PJ_INLINE(void*) pj_pool_zalloc(pj_pool_t *pool, pj_size_t size) 
     475{ 
     476    return pj_pool_calloc(pool, 1, size); 
     477} 
     478 
     479 
     480/** 
     481 * This macro allocates memory from the pool and returns the instance of 
     482 * the specified type. It provides a stricker type safety than pj_pool_alloc() 
     483 * since the return value of this macro will be type-casted to the specified 
     484 * type. 
     485 * 
     486 * @param pool      The pool 
     487 * @param type      The type of object to be allocated 
     488 * 
     489 * @return          Memory buffer of the specified type. 
     490 */ 
     491#define PJ_POOL_ALLOC_TYPE(pool,type) \ 
     492            ((type*)pj_pool_alloc(pool, sizeof(type))) 
     493 
     494/** 
     495 * This macro allocates memory from the pool, zeroes the buffer, and  
     496 * returns the instance of the specified type. It provides a stricker type  
     497 * safety than pj_pool_zalloc() since the return value of this macro will be  
     498 * type-casted to the specified type. 
     499 * 
     500 * @param pool      The pool 
     501 * @param type      The type of object to be allocated 
     502 * 
     503 * @return          Memory buffer of the specified type. 
     504 */ 
     505#define PJ_POOL_ZALLOC_TYPE(pool,type) \ 
     506            ((type*)pj_pool_zalloc(pool, sizeof(type))) 
     507 
    472508 
    473509 
Note: See TracChangeset for help on using the changeset viewer.