Annotation of OpenXM_contrib/gnuplot/alloc.h, Revision 1.1
1.1 ! maekawa 1: /* $Id: alloc.h,v 1.6 1998/03/22 22:31:17 drd Exp $ */
! 2:
! 3: /* GNUPLOT - alloc.h */
! 4:
! 5: /*[
! 6: * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
! 7: *
! 8: * Permission to use, copy, and distribute this software and its
! 9: * documentation for any purpose with or without fee is hereby granted,
! 10: * provided that the above copyright notice appear in all copies and
! 11: * that both that copyright notice and this permission notice appear
! 12: * in supporting documentation.
! 13: *
! 14: * Permission to modify the software is granted, but not the right to
! 15: * distribute the complete modified source code. Modifications are to
! 16: * be distributed as patches to the released version. Permission to
! 17: * distribute binaries produced by compiling modified sources is granted,
! 18: * provided you
! 19: * 1. distribute the corresponding source modifications from the
! 20: * released version in the form of a patch file along with the binaries,
! 21: * 2. add special version identification to distinguish your version
! 22: * in addition to the base release version number,
! 23: * 3. provide your name and address as the primary contact for the
! 24: * support of your modified version, and
! 25: * 4. retain our contact information in regard to use of the base
! 26: * software.
! 27: * Permission to distribute the released version of the source code along
! 28: * with corresponding source modifications in the form of a patch file is
! 29: * granted with same provisions 2 through 4 for binary distributions.
! 30: *
! 31: * This software is provided "as is" without express or implied warranty
! 32: * to the extent permitted by applicable law.
! 33: ]*/
! 34:
! 35: /* prototypes from "alloc.c". This file figures out if the free hack is needed
! 36: * and redefines free if necessary.
! 37: */
! 38:
! 39: char *gp_alloc __PROTO((unsigned long size, char *message));
! 40: generic *gp_realloc __PROTO((generic *p, unsigned long size, char *message));
! 41:
! 42: /* dont define CHECK_HEAP_USE on a FARALLOC machine ! */
! 43:
! 44: #ifdef CHECK_HEAP_USE
! 45:
! 46: /* all allocated blocks have guards at front and back.
! 47: * CHECK_POINTER checks guards on block, and checks that p is in range
! 48: * START_LEAK_CHECK and END_LEAK_CHECK allow assert that no net memory
! 49: * is allocated within enclosed block
! 50: */
! 51:
! 52: void checked_free(void *p);
! 53: void check_pointer_in_block(void *block, void *p, int size, char *file, int line);
! 54: void start_leak_check(char *file,int line);
! 55: void end_leak_check(char *file,int line);
! 56: # define free(x) checked_free(x)
! 57: # define CHECK_POINTER(block, p) check_pointer_in_block(block, p, sizeof(*p), __FILE__, __LINE__)
! 58: # define START_LEAK_CHECK() start_leak_check(__FILE__, __LINE__)
! 59: # define END_LEAK_CHECK() end_leak_check(__FILE__, __LINE__)
! 60: #else
! 61: # define CHECK_POINTER(block, p) /*nowt*/
! 62: # define START_LEAK_CHECK() /*nowt*/
! 63: # define END_LEAK_CHECK() /*nowt*/
! 64: #endif
! 65:
! 66: #if defined(MSDOS) && defined(__TURBOC__) && !defined(DOSX286) || defined(_Windows) && !defined(WIN32)
! 67: #define FARALLOC
! 68: void gpfree __PROTO((generic *p));
! 69: #define free gpfree
! 70: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>