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.69 2004/04/03 15:22:12 mast Exp $ + || $Id: block_alloc.h,v 1.70 2004/04/03 15:45:41 mast Exp $   */      #undef PRE_INIT_BLOCK   #undef DO_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   #undef COUNT_OTHER -  + #undef DMALLOC_DESCRIBE_BLOCK   #undef BLOCK_ALLOC_HSIZE_SHIFT   #undef MAX_EMPTY_BLOCKS   #undef BLOCK_ALLOC_FILL_PAGES   #undef PTR_HASH_ALLOC_FILL_PAGES   #undef PTR_HASH_ALLOC_FIXED_FILL_PAGES      /* Note: The block_alloc mutex is held while PRE_INIT_BLOCK runs. */   #define PRE_INIT_BLOCK(X)   #define INIT_BLOCK(X)   #define EXIT_BLOCK(X)   #define COUNT_BLOCK(X)   #define COUNT_OTHER() -  + #define DMALLOC_DESCRIBE_BLOCK(X)   #define BLOCK_ALLOC_HSIZE_SHIFT 2   #define MAX_EMPTY_BLOCKS 4      #ifndef BLOCK_ALLOC_USED   #define BLOCK_ALLOC_USED DO_IF_DMALLOC(real_used) DO_IF_NOT_DMALLOC(used)   #endif      /* Invalidate the block as far as possible if running with dmalloc.    */   #define DO_PRE_INIT_BLOCK(X) do { \
pike.git/src/block_alloc.h:186:    { \    if( (char *)d < (char *)tmp) continue; \    if( (char *)d >= (char *)(tmp->x+(BSIZE))) continue; \    if ((char *) d - (char *) tmp->x != \    (d - tmp->x) * (ptrdiff_t) sizeof (struct DATA)) break; \    return; \    } \    Pike_fatal("really_free_%s called on non-block_alloc region (%p).\n", \    #DATA, d); \   } \ +  \ + static void PIKE_CONCAT (dmalloc_describe_, DATA) (struct DATA *d) \ + { \ +  DMALLOC_DESCRIBE_BLOCK (d); \ + } \   ) \    \   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:265:    blk->next->prev = blk->prev; \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    } else { \    PIKE_CONCAT(DATA,_blocks) = blk->next; \    blk->next->prev = NULL; \    } \    \    DO_IF_DMALLOC({ \    size_t i; \    for (i = 0; i < (BSIZE); i++) { \ -  dmalloc_check_block_free(blk->x + i, DMALLOC_LOCATION()); \ +  dmalloc_check_block_free( \ +  blk->x + i, DMALLOC_LOCATION(), \ +  (describe_block_fn *) PIKE_CONCAT (dmalloc_describe_, DATA)); \    dmalloc_unregister(blk->x + i, 1); \    } \    }); \    \    /* Mark meta-block as available, since libc will mess with it. */ \    PIKE_MEM_RW(*blk); \    free(blk); \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    } \    \
pike.git/src/block_alloc.h:289:   static void PIKE_CONCAT3(free_all_,DATA,_blocks_unlocked)(void) \   { \    struct PIKE_CONCAT(DATA,_block) *tmp; \    DO_IF_DMALLOC( \    MEMSET(PIKE_CONCAT(DATA,s_to_free), 0, sizeof(PIKE_CONCAT(DATA,s_to_free))); \    for(tmp=PIKE_CONCAT(DATA,_blocks);tmp;tmp=tmp->next) \    { \    size_t tmp2; \    for(tmp2=0;tmp2<(BSIZE);tmp2++) \    { \ -  dmalloc_check_block_free(tmp->x+tmp2, DMALLOC_LOCATION()); \ +  dmalloc_check_block_free( \ +  tmp->x+tmp2, DMALLOC_LOCATION(), \ +  (describe_block_fn *) PIKE_CONCAT (dmalloc_describe_, DATA)); \    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); \    free((char *)tmp); \