Branch: Tag:

2002-11-23

2002-11-23 20:01:44 by Martin Stjernholm <mast@lysator.liu.se>

A little less code duplication.

Rev: src/pike_memory.h:1.40

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: pike_memory.h,v 1.39 2002/11/23 17:26:50 mast Exp $ + || $Id: pike_memory.h,v 1.40 2002/11/23 20:01:44 mast Exp $   */      #ifndef MEMORY_H
19: Inside #if defined(USE_VALGRIND)
     /* No Access */   #define PIKE_MEM_NA(lvalue) do { \ -  VALGRIND_DISCARD(VALGRIND_MAKE_NOACCESS(&(lvalue), sizeof (lvalue))); \ +  PIKE_MEM_NA_RANGE(&(lvalue), sizeof (lvalue)); \    } while (0)   #define PIKE_MEM_NA_RANGE(addr, bytes) do { \    VALGRIND_DISCARD(VALGRIND_MAKE_NOACCESS(addr, bytes)); \
27:      /* Write Only -- Will become RW when having been written to */   #define PIKE_MEM_WO(lvalue) do { \ -  VALGRIND_DISCARD(VALGRIND_MAKE_WRITABLE(&(lvalue), sizeof (lvalue))); \ +  PIKE_MEM_WO_RANGE(&(lvalue), sizeof (lvalue)); \    } while (0)   #define PIKE_MEM_WO_RANGE(addr, bytes) do { \    VALGRIND_DISCARD(VALGRIND_MAKE_WRITABLE(addr, bytes)); \
35:      /* Read/Write */   #define PIKE_MEM_RW(lvalue) do { \ -  VALGRIND_DISCARD(VALGRIND_MAKE_READABLE(&(lvalue), sizeof (lvalue))); \ +  PIKE_MEM_RW_RANGE(&(lvalue), sizeof (lvalue)); \    } while (0)   #define PIKE_MEM_RW_RANGE(addr, bytes) do { \    VALGRIND_DISCARD(VALGRIND_MAKE_READABLE(addr, bytes)); \
43:      /* Read Only -- Not currently supported by valgrind */   #define PIKE_MEM_RO(lvalue) do { \ -  VALGRIND_DISCARD(VALGRIND_MAKE_READABLE(&(lvalue), sizeof (lvalue))); \ +  PIKE_MEM_RO_RANGE(&(lvalue), sizeof (lvalue)); \    } while (0)   #define PIKE_MEM_RO_RANGE(addr, bytes) do { \    VALGRIND_DISCARD(VALGRIND_MAKE_READABLE(addr, bytes)); \