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.82 2006/07/05 19:24:18 mast Exp $ + || $Id: block_alloc.h,v 1.83 2007/04/02 17:03:47 grubba 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:273:    struct DATA *d2; \    blk = PIKE_CONCAT(DATA,_free_blocks); \    if(blk == NULL || (char *)d < (char *)blk || \    (char *)d >= (char *)(blk->x+(BSIZE))) { \    blk = PIKE_CONCAT(DATA,_blocks); \    while (blk && ((char *)d < (char *)blk || \    (char *)d >= (char *)(blk->x+(BSIZE)))) \    blk = blk->next; \    } \    if (blk) { \ -  if (!dmalloc_check_allocated (d, 0)) \ +  if (!dmalloc_check_allocated (d, 0)) { \ +  debug_malloc_dump_references(d, 0, 2, 0); \    Pike_fatal ("really_free_" TOSTR(DATA) " called with " \    "unknown pointer %p (probably already freed)\n", d); \ -  +  } \    blk->used--; \    dmalloc_mark_as_free(d, 1); \    PIKE_MEM_NA(*d); \    d2 = PIKE_CONCAT(DATA,s_to_free)[PIKE_CONCAT(DATA,s_to_free_ptr)]; \    PIKE_CONCAT(DATA,s_to_free)[PIKE_CONCAT(DATA,s_to_free_ptr)] = d; \    PIKE_CONCAT(DATA,s_to_free_ptr) = \    (PIKE_CONCAT(DATA,s_to_free_ptr) + 1) % \    NELEM(PIKE_CONCAT(DATA,s_to_free)); \    if ((d = d2)) \    PIKE_MEM_WO(*d); \
pike.git/src/block_alloc.h:335:    } \    \    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({ \ +  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({ \    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \ -  blk->PIKE_CONCAT3(free_,DATA,s)=d; \ +  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 */ \    /* know there's at least one more empty block. */ \    if((blk->prev->next = blk->next)) \    blk->next->prev = blk->prev; \