Branch: Tag:

2002-11-23

2002-11-23 17:03:00 by Martin Stjernholm <mast@lysator.liu.se>

Simplified the memchecker macros a little and made them statementesque.

Rev: src/block_alloc.h:1.52
Rev: src/las.c:1.312
Rev: src/pike_memory.h:1.38

2:   || 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.51 2002/11/23 15:58:02 mast Exp $ + || $Id: block_alloc.h,v 1.52 2002/11/23 17:03:00 mast Exp $   */      #undef PRE_INIT_BLOCK
81:    } \    n->PIKE_CONCAT3(free_,DATA,s)=&n->x[(BSIZE)-1]; \    /* Mark the new blocks as unavailable for now... */ \ -  PIKE_MEM_NA(&n->x, sizeof(n->x)); \ +  PIKE_MEM_NA(n->x); \   } \    \   BA_STATIC BA_INLINE struct DATA *BA_UL(PIKE_CONCAT(alloc_,DATA))(void) \
103:    \    tmp = blk->PIKE_CONCAT3(free_,DATA,s); \    /* Mark the new block as available. */ \ -  PIKE_MEM_RW(tmp, sizeof(*tmp)); \ +  PIKE_MEM_RW(*tmp); \    if(!(blk->PIKE_CONCAT3(free_,DATA,s) = (void *)tmp->BLOCK_ALLOC_NEXT)) \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    DO_IF_DMALLOC( \
111:    dmalloc_register(tmp,sizeof(struct DATA), DMALLOC_LOCATION()); \    ) \    /* Mark the new block as available but uninitialized. */ \ -  PIKE_MEM_WO(tmp, sizeof(*tmp)); \ +  PIKE_MEM_WO(*tmp); \    INIT_BLOCK(tmp); \    return tmp; \   } \
173:    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    /* Mark block as unavailable. */ \ -  PIKE_MEM_NA(d, sizeof(*d)); \ +  PIKE_MEM_NA(*d); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    if(!--blk->used && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \
186:    blk->next->prev = NULL; \    } \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(blk, sizeof(*blk)); \ +  PIKE_MEM_RW(*blk); \    free(blk); \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    } \
225:    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    PRE_INIT_BLOCK(d); \    /* Mark block as unavailable. */ \ -  PIKE_MEM_NA(d, sizeof(*d)); \ +  PIKE_MEM_NA(*d); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    if(!--blk->used && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \
238:    blk->next->prev = NULL; \    } \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(blk, sizeof(*blk)); \ +  PIKE_MEM_RW(*blk); \    free(blk); \    --PIKE_CONCAT3(num_empty_,DATA,_blocks); \    } \
264:    { \    PIKE_CONCAT(DATA,_blocks)=tmp->next; \    /* Mark meta-block as available, since libc will mess with it. */ \ -  PIKE_MEM_RW(&tmp->x, sizeof(tmp->x)); \ +  PIKE_MEM_RW(tmp->x); \    free((char *)tmp); \    } \    PIKE_CONCAT(DATA,_blocks)=0; \