pike.git / src / block_alloc.h

version» Context lines:

pike.git/src/block_alloc.h:1: - /* $Id: block_alloc.h,v 1.37 2001/09/08 11:33:15 grubba Exp $ */ + /* $Id: block_alloc.h,v 1.38 2001/09/25 21:23:30 hubbe 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   #undef COUNT_OTHER   
pike.git/src/block_alloc.h:82:   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)(); \    DO_IF_RUN_UNLOCKED(mt_unlock(&PIKE_CONCAT(DATA,_mutex))); \    return ret; \   }) \    \ + DO_IF_DMALLOC( \ + static void PIKE_CONCAT(check_free_,DATA)(struct DATA *d) \ + { \ +  struct PIKE_CONCAT(DATA,_block) *tmp; \ +  for(tmp=PIKE_CONCAT(DATA,_blocks);tmp;tmp=tmp->next) \ +  { \ +  if( (char *)d < (char *)tmp) continue; \ +  if( (char *)d >= (char *)(tmp->x+BSIZE)) continue; \ +  return; \ +  } \ +  fatal("really_free_%s called on non-block_alloc region (%p).\n", \ +  #DATA, d); \ + } \ + ) \ +  \   DO_IF_RUN_UNLOCKED( \   void PIKE_CONCAT3(really_free_,DATA,_unlocked)(struct DATA *d) \   { \    EXIT_BLOCK(d); \ -  DO_IF_DMALLOC( dmalloc_unregister(d, 1); ) \ +  DO_IF_DMALLOC( PIKE_CONCAT(check_free_,DATA)(d); \ +  dmalloc_unregister(d, 1); ) \    d->BLOCK_ALLOC_NEXT = (void *)PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    PIKE_CONCAT3(free_,DATA,s)=d; \   }) \    \   void PIKE_CONCAT(really_free_,DATA)(struct DATA *d) \   { \    EXIT_BLOCK(d); \    DO_IF_RUN_UNLOCKED(mt_lock(&PIKE_CONCAT(DATA,_mutex))); \ -  DO_IF_DMALLOC( dmalloc_unregister(d, 1); ) \ +  DO_IF_DMALLOC( PIKE_CONCAT(check_free_,DATA)(d); \ +  dmalloc_unregister(d, 1); ) \    d->BLOCK_ALLOC_NEXT = (void *)PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    PIKE_CONCAT3(free_,DATA,s)=d; \    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( \