| 1 | /* $Id: electric.h 915 2007-05-24 05:00:18Z bird $ */
 | 
|---|
| 2 | /** @file
 | 
|---|
| 3 |  *
 | 
|---|
| 4 |  * A simple electric heap implementation, wrapper header.
 | 
|---|
| 5 |  *
 | 
|---|
| 6 |  * Copyright (c) 2007 knut st. osmundsen <bird-src-spam@anduin.net>
 | 
|---|
| 7 |  *
 | 
|---|
| 8 |  *
 | 
|---|
| 9 |  * This program is free software; you can redistribute it and/or modify
 | 
|---|
| 10 |  * it under the terms of the GNU Lesser General Public License as published
 | 
|---|
| 11 |  * by the Free Software Foundation; either version 2 of the License, or
 | 
|---|
| 12 |  * (at your option) any later version.
 | 
|---|
| 13 |  *
 | 
|---|
| 14 |  * This program is distributed in the hope that it will be useful,
 | 
|---|
| 15 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 16 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 17 |  * GNU Lesser General Public License for more details.
 | 
|---|
| 18 |  *
 | 
|---|
| 19 |  * You should have received a copy of the GNU Lesser General Public License
 | 
|---|
| 20 |  * along with This program; if not, write to the Free Software
 | 
|---|
| 21 |  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
| 22 |  *
 | 
|---|
| 23 |  */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | #ifdef ELECTRIC_HEAP
 | 
|---|
| 26 | 
 | 
|---|
| 27 | #include <stdlib.h>
 | 
|---|
| 28 | #ifdef WINDOWS32
 | 
|---|
| 29 | # include <malloc.h>
 | 
|---|
| 30 | #endif
 | 
|---|
| 31 | #include <string.h> /* strdup */
 | 
|---|
| 32 | 
 | 
|---|
| 33 | void xfree (void *);
 | 
|---|
| 34 | void *xcalloc (size_t, size_t);
 | 
|---|
| 35 | void *xmalloc (unsigned int);
 | 
|---|
| 36 | void *xrealloc (void *, unsigned int);
 | 
|---|
| 37 | char *xstrdup (const char *);
 | 
|---|
| 38 | 
 | 
|---|
| 39 | #define free(a)         xfree(a)
 | 
|---|
| 40 | #define calloc(a,b)     xcalloc((a),(b))
 | 
|---|
| 41 | #define malloc(a)       xmalloc(a)
 | 
|---|
| 42 | #define realloc(a,b)    xrealloc((a),(b))
 | 
|---|
| 43 | #define strdup(a)       xstrdup(a)
 | 
|---|
| 44 | 
 | 
|---|
| 45 | #endif
 | 
|---|
| 46 | 
 | 
|---|