root/common/trunk/src/memory.h
@
205
| Revision 205, 2.7 KB (checked in by piers, 14 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * FILE: memory.h |
| 3 | * PROGRAM: RAT |
| 4 | * AUTHOR: Isidor Kouvelas + Colin Perkins + Orion Hodson |
| 5 | * |
| 6 | * $Revision$ |
| 7 | * $Date$ |
| 8 | * |
| 9 | * Copyright (c) 1995-98 University College London |
| 10 | * All rights reserved. |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, is permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer. |
| 17 | * 2. Redistributions in binary form must reproduce the above copyright |
| 18 | * notice, this list of conditions and the following disclaimer in the |
| 19 | * documentation and/or other materials provided with the distribution. |
| 20 | * 3. All advertising materials mentioning features or use of this software |
| 21 | * must display the following acknowledgement: |
| 22 | * This product includes software developed by the Computer Science |
| 23 | * Department at University College London |
| 24 | * 4. Neither the name of the University nor of the Department may be used |
| 25 | * to endorse or promote products derived from this software without |
| 26 | * specific prior written permission. |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND |
| 28 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE |
| 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | * SUCH DAMAGE. |
| 38 | */ |
| 39 | |
| 40 | #ifndef _RAT_MEMORY_H |
| 41 | #define _RAT_MEMORY_H |
| 42 | |
| 43 | #define xrealloc(p,x) _xrealloc(p, x,__FILE__,__LINE__) |
| 44 | #define xmalloc(x) _xmalloc(x,__FILE__,__LINE__) |
| 45 | #define xstrdup(x) _xstrdup(x,__FILE__,__LINE__) |
| 46 | |
| 47 | #if defined(__cplusplus) |
| 48 | extern "C" { |
| 49 | #endif |
| 50 | |
| 51 | /* Debug Functions */ |
| 52 | void xdoneinit(void); |
| 53 | void xmemchk(void); |
| 54 | void xmemdmp(void); |
| 55 | void xclaim(void *p, const char *filen, int line); |
| 56 | void xmemdist(FILE *fp); |
| 57 | |
| 58 | /* Replacements for regular memory fn's */ |
| 59 | void xfree(void *x); |
| 60 | void *_xmalloc(unsigned size,const char *filen,int line); |
| 61 | void *_xrealloc(void *p,unsigned size,const char *filen,int line); |
| 62 | char *_xstrdup(const char *s1, const char *filen, int line); |
| 63 | void *_block_alloc(unsigned size, const char *filen, int line); |
| 64 | void _block_free(void *p, int size, int line); |
| 65 | |
| 66 | #if defined(__cplusplus) |
| 67 | } |
| 68 | #endif |
| 69 | |
| 70 | #endif |
Note: See TracBrowser
for help on using the browser.
