pike.git / src / block_alloc.h

version» Context lines:

pike.git/src/block_alloc.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: block_alloc.h,v 1.51 2002/11/23 15:58:02 mast Exp $ + || $Id: block_alloc.h,v 1.52 2002/11/23 17:03:00 mast Exp $   */      #undef PRE_INIT_BLOCK   #undef INIT_BLOCK   #undef EXIT_BLOCK   #undef BLOCK_ALLOC   #undef LOW_PTR_HASH_ALLOC   #undef PTR_HASH_ALLOC_FIXED   #undef PTR_HASH_ALLOC   #undef COUNT_BLOCK
pike.git/src/block_alloc.h:74:    \    n->x[0].BLOCK_ALLOC_NEXT=NULL; \    PRE_INIT_BLOCK( n->x ); \    for(e=1;e<(BSIZE);e++) \    { \    n->x[e].BLOCK_ALLOC_NEXT=(void *)&n->x[e-1]; \    PRE_INIT_BLOCK( (n->x+e) ); \    } \    n->PIKE_CONCAT3(free_,DATA,s)=&n->x[(BSIZE)-1]; \    /* Mark the new blocks as unavailable for now... */ \ -  PIKE_MEM_NA(&n->x, sizeof(n->x)); \ +  PIKE_MEM_NA(n->x); \   } \    \   BA_STATIC BA_INLINE struct DATA *BA_UL(PIKE_CONCAT(alloc_,DATA))(void) \   { \    struct DATA *tmp; \    struct PIKE_CONCAT(DATA,_block) *blk; \    \    if(!(blk = PIKE_CONCAT(DATA,_free_blocks))) { \    PIKE_CONCAT(alloc_more_,DATA)(); \    blk = PIKE_CONCAT(DATA,_blocks); \
pike.git/src/block_alloc.h:96:    } \    DO_IF_DEBUG( \    else if (PIKE_CONCAT(DATA,_free_blocks) == (void *)-1) \    Pike_fatal("Block alloc " #DATA " not initialized.\n"); \    ) \    else if(!blk->used++) \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    \    tmp = blk->PIKE_CONCAT3(free_,DATA,s); \    /* Mark the new block as available. */ \ -  PIKE_MEM_RW(tmp, sizeof(*tmp)); \ +  PIKE_MEM_RW(*tmp); \    if(!(blk->PIKE_CONCAT3(free_,DATA,s) = (void *)tmp->BLOCK_ALLOC_NEXT)) \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    DO_IF_DMALLOC( \    dmalloc_unregister(tmp, 1); \    dmalloc_register(tmp,sizeof(struct DATA), DMALLOC_LOCATION()); \    ) \    /* Mark the new block as available but uninitialized. */ \ -  PIKE_MEM_WO(tmp, sizeof(*tmp)); \ +  PIKE_MEM_WO(*tmp); \    INIT_BLOCK(tmp); \    return tmp; \   } \    \   DO_IF_RUN_UNLOCKED( \   struct DATA *PIKE_CONCAT(alloc_,DATA)(void) \   { \    struct DATA *ret; \    DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \    ret=PIKE_CONCAT3(alloc_,DATA,_unlocked)(); \
pike.git/src/block_alloc.h:166:    PIKE_CONCAT(DATA,_blocks) = blk; \    } \    if(PIKE_CONCAT(DATA,_free_blocks) == NULL) \    PIKE_CONCAT(DATA,_free_blocks) = blk; \    } \    DO_IF_DMALLOC( PIKE_CONCAT(check_free_,DATA)(d); \    dmalloc_mark_as_free(d, 1); ) \    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    /* Mark block as unavailable. */ \ -  PIKE_MEM_NA(d, sizeof(*d)); \ +  PIKE_MEM_NA(*d); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    if(!--blk->used && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) { \    if((blk->prev->next = blk->next)) \    blk->next->prev = blk->prev; \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    } else { \    PIKE_CONCAT(DATA,_blocks) = blk->next; \    blk->next->prev = NULL; \    } \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(blk, sizeof(*blk)); \ +  PIKE_MEM_RW(*blk); \    free(blk); \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    } \   }) \    \   void PIKE_CONCAT(really_free_,DATA)(struct DATA *d) \   { \    struct PIKE_CONCAT(DATA,_block) *blk; \    EXIT_BLOCK(d); \    DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \
pike.git/src/block_alloc.h:218:    PIKE_CONCAT(DATA,_blocks) = blk; \    } \    if(PIKE_CONCAT(DATA,_free_blocks) == NULL) \    PIKE_CONCAT(DATA,_free_blocks) = blk; \    } \    DO_IF_DMALLOC( PIKE_CONCAT(check_free_,DATA)(d); \    dmalloc_mark_as_free(d, 1); ) \    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    /* Mark block as unavailable. */ \ -  PIKE_MEM_NA(d, sizeof(*d)); \ +  PIKE_MEM_NA(*d); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    if(!--blk->used && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) { \    if((blk->prev->next = blk->next)) \    blk->next->prev = blk->prev; \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    } else { \    PIKE_CONCAT(DATA,_blocks) = blk->next; \    blk->next->prev = NULL; \    } \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(blk, sizeof(*blk)); \ +  PIKE_MEM_RW(*blk); \    free(blk); \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    } \    DO_IF_RUN_UNLOCKED(mt_unlock(&PIKE_CONCAT(DATA,_mutex))); \   } \    \   static void PIKE_CONCAT3(free_all_,DATA,_blocks_unlocked)(void) \   { \    struct PIKE_CONCAT(DATA,_block) *tmp; \    DO_IF_DMALLOC( \
pike.git/src/block_alloc.h:257:    { \    dmalloc_check_block_free(tmp->x+tmp2, DMALLOC_LOCATION()); \    dmalloc_unregister(tmp->x+tmp2, 1); \    } \    } \    ) \    while((tmp=PIKE_CONCAT(DATA,_blocks))) \    { \    PIKE_CONCAT(DATA,_blocks)=tmp->next; \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(&tmp->x, sizeof(tmp->x)); \ +  PIKE_MEM_RW(tmp->x); \    free((char *)tmp); \    } \    PIKE_CONCAT(DATA,_blocks)=0; \    PIKE_CONCAT(DATA,_free_blocks)=0; \    PIKE_CONCAT3(num_empty_,DATA,_blocks)=0; \   } \    \   void PIKE_CONCAT3(free_all_,DATA,_blocks)(void) \   { \    DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \