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.47 2002/10/28 13:01:07 nilsson Exp $ + || $Id: block_alloc.h,v 1.48 2002/11/19 13:53:48 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:67:    } \    if((n->next=PIKE_CONCAT(DATA,_blocks))) \    n->next->prev=n; \    n->prev=NULL; \    n->used=0; \    PIKE_CONCAT(DATA,_blocks)=n; \    PIKE_CONCAT(DATA,_free_blocks)=n; \    \    n->x[0].BLOCK_ALLOC_NEXT=NULL; \    PRE_INIT_BLOCK( n->x ); \ -  for(e=1;e<BSIZE;e++) \ +  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]; \ +  n->PIKE_CONCAT3(free_,DATA,s)=&n->x[(BSIZE)-1]; \   } \    \   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:120:    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; \ +  if( (char *)d >= (char *)(tmp->x+(BSIZE))) continue; \    return; \    } \    Pike_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) \   { \    struct PIKE_CONCAT(DATA,_block) *blk = PIKE_CONCAT(DATA,_free_blocks); \    if(blk == NULL || (char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)) { \ +  (char *)d >= (char *)(blk->x+(BSIZE))) { \    blk = PIKE_CONCAT(DATA,_blocks); \    if((char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)) { \ +  (char *)d >= (char *)(blk->x+(BSIZE))) { \    do \    blk = blk->next; \    while((char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)); \ +  (char *)d >= (char *)(blk->x+(BSIZE))); \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    blk->prev->next = blk->next; \    if(blk->next) \    blk->next->prev = blk->prev; \    blk->prev = NULL; \    blk->next = PIKE_CONCAT(DATA,_blocks); \    blk->next->prev = blk; \    PIKE_CONCAT(DATA,_blocks) = blk; \    } \
pike.git/src/block_alloc.h:182:    } \   }) \    \   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))); \    blk = PIKE_CONCAT(DATA,_free_blocks); \    if(blk == NULL || (char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)) { \ +  (char *)d >= (char *)(blk->x+(BSIZE))) { \    blk = PIKE_CONCAT(DATA,_blocks); \    if((char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)) { \ +  (char *)d >= (char *)(blk->x+(BSIZE))) { \    do \    blk = blk->next; \    while((char *)d < (char *)blk || \ -  (char *)d >= (char *)(blk->x+BSIZE)); \ +  (char *)d >= (char *)(blk->x+(BSIZE))); \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    blk->prev->next = blk->next; \    if(blk->next) \    blk->next->prev = blk->prev; \    blk->prev = NULL; \    blk->next = PIKE_CONCAT(DATA,_blocks); \    blk->next->prev = blk; \    PIKE_CONCAT(DATA,_blocks) = blk; \    } \
pike.git/src/block_alloc.h:232:   } \    \   static void PIKE_CONCAT3(free_all_,DATA,_blocks_unlocked)(void) \   { \    struct PIKE_CONCAT(DATA,_block) *tmp; \    DO_IF_DMALLOC( \    for(tmp=PIKE_CONCAT(DATA,_blocks);tmp;tmp=tmp->next) \    { \    int tmp2; \    extern void dmalloc_check_block_free(void *p, char *loc); \ -  for(tmp2=0;tmp2<BSIZE;tmp2++) \ +  for(tmp2=0;tmp2<(BSIZE);tmp2++) \    { \    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; \    free((char *)tmp); \