pike.git / src / block_alloc.h

version» Context lines:

pike.git/src/block_alloc.h:1: - /* $Id: block_alloc.h,v 1.34 2001/09/01 07:20:29 hubbe Exp $ */ + /* $Id: block_alloc.h,v 1.35 2001/09/02 21:08:29 grubba Exp $ */   #undef PRE_INIT_BLOCK   #undef INIT_BLOCK   #undef EXIT_BLOCK   #undef BLOCK_ALLOC   #undef PTR_HASH_ALLOC   #undef COUNT_BLOCK   #undef COUNT_OTHER      #define PRE_INIT_BLOCK(X)   #define INIT_BLOCK(X)   #define EXIT_BLOCK(X)   #define COUNT_BLOCK(X)   #define COUNT_OTHER()      #ifdef PIKE_RUN_UNLOCKED   #include "threads.h"      /* Block Alloc UnLocked */   #define BA_UL(X) PIKE_CONCAT(X,_unlocked)   #define BA_STATIC static -  + #define BA_INLINE inline   #else   #define BA_UL(X) X   #define BA_STATIC -  + #define BA_INLINE   #endif      #define BLOCK_ALLOC(DATA,BSIZE) \    \   struct PIKE_CONCAT(DATA,_block) \   { \    struct PIKE_CONCAT(DATA,_block) *next; \    struct DATA x[BSIZE]; \   }; \    \
pike.git/src/block_alloc.h:51:    PIKE_CONCAT(DATA,_blocks)=n; \    \    for(e=0;e<BSIZE;e++) \    { \    n->x[e].BLOCK_ALLOC_NEXT=(void *)PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK( (n->x+e) ); \    PIKE_CONCAT3(free_,DATA,s)=n->x+e; \    } \   } \    \ - BA_STATIC inline struct DATA *BA_UL(PIKE_CONCAT(alloc_,DATA))(void) \ + BA_STATIC BA_INLINE struct DATA *BA_UL(PIKE_CONCAT(alloc_,DATA))(void) \   { \    struct DATA *tmp; \    if(!PIKE_CONCAT3(free_,DATA,s)) \    PIKE_CONCAT(alloc_more_,DATA)(); \    DO_IF_DEBUG( \    else if (PIKE_CONCAT3(free_,DATA,s) == (struct DATA *)-1) \    fatal("Block alloc not initialized.\n"); \    ) \    \    tmp=PIKE_CONCAT3(free_,DATA,s); \    PIKE_CONCAT3(free_,DATA,s)=(struct DATA *)tmp->BLOCK_ALLOC_NEXT; \    DO_IF_DMALLOC( dmalloc_register(tmp,sizeof(struct DATA), DMALLOC_LOCATION()); )\    INIT_BLOCK(tmp); \    return tmp; \   } \    \   DO_IF_RUN_UNLOCKED( \ - inline struct DATA *PIKE_CONCAT(alloc_,DATA)(void) \ + 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_RUN_UNLOCKED( \   void PIKE_CONCAT3(really_free_,DATA,_unlocked)(struct DATA *d) \