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.86 2008/05/24 12:02:05 mast Exp $ + || $Id: block_alloc.h,v 1.87 2008/05/24 12:18:50 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
pike.git/src/block_alloc.h:38:   #define DMALLOC_DESCRIBE_BLOCK(X)   #define BLOCK_ALLOC_HSIZE_SHIFT 2   #define MAX_EMPTY_BLOCKS 4 /* Must be >= 1. */      #ifndef BLOCK_ALLOC_USED   #define BLOCK_ALLOC_USED DO_IF_DMALLOC(real_used) DO_IF_NOT_DMALLOC(used)   #endif      #if defined (DMALLOC_BLOCK_BACKLOG) && defined (DEBUG_MALLOC)   #define DO_IF_BLOCK_BACKLOG(X) X + #define DO_IF_NOT_BLOCK_BACKLOG(X)   #else   #define DO_IF_BLOCK_BACKLOG(X) -  + #define DO_IF_NOT_BLOCK_BACKLOG(X) X   #endif      /* Invalidate the block as far as possible if running with dmalloc.    */   #define DO_PRE_INIT_BLOCK(X) do { \    DO_IF_DMALLOC(MEMSET((X), 0x55, sizeof(*(X)))); \    PRE_INIT_BLOCK(X); \    } while (0)      #ifndef PIKE_HASH_T
pike.git/src/block_alloc.h:352:    } \    \    DO_IF_DEBUG ( \    if ((char *) d < (char *) &blk->x || \    ((char *) d - (char *) &blk->x) % sizeof (struct DATA)) \    Pike_fatal ("really_free_" TOSTR(DATA) \    " got misaligned pointer %p\n", d); \    ); \    \    DO_PRE_INIT_BLOCK(d); \ -  DO_IF_DMALLOC({ \ +  DO_IF_BLOCK_BACKLOG ({ \    struct DATA *d2 = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    d->BLOCK_ALLOC_NEXT = NULL; \    if (d2) { \    while (d2->BLOCK_ALLOC_NEXT) { \    if (PTR_TO_INT(d2->BLOCK_ALLOC_NEXT) == 0x55555555) { \    debug_malloc_dump_references(d2, 0, 2, 0); \    Pike_fatal("Bad next pointer in free list.\n"); \    } \    d2 = (void *)d2->BLOCK_ALLOC_NEXT; \    } \    d2->BLOCK_ALLOC_NEXT = (void *)d; \    } else { \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    } \    }); \ -  DO_IF_NOT_DMALLOC({ \ +  DO_IF_NOT_BLOCK_BACKLOG ({ \    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    }); \    /* Mark block as unavailable. */ \    PIKE_MEM_NA(*d); \    \    if(!--blk->BLOCK_ALLOC_USED && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) { \    /* blk->prev isn't NULL because MAX_EMPTY_BLOCKS >= 1 so we */ \