1 /* heap.h -- 2 * Created: Sun Aug 10 19:33:53 2003 by vle@gmx.net 3 * Copyright 2003 Aleksey Cheusov <vle@gmx.net> 4 * This program comes with ABSOLUTELY NO WARRANTY. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the 8 * Free Software Foundation; either version 1, or (at your option) any 9 * later version. 10 * 11 * This program is distributed in the hope that it will be useful, but 12 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program; if not, write to the Free Software Foundation, Inc., 18 * 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 /* create a heap. 'opts' MUST BE NULL at this time */ 22 23 #ifndef DONOT_USE_INTERNAL_HEAP 24 25 extern int heap_create (void **heap, void *opts); 26 extern const char *heap_error (int err_code); 27 extern void heap_destroy (void **heap); 28 extern void * heap_alloc (void *heap, size_t size); 29 extern char * heap_strdup (void *heap, const char *s); 30 extern void heap_free (void *heap, void *p); 31 extern void * heap_realloc (void *heap, void *p, size_t size); 32 extern int heap_isempty (void *heap); 33 34 #else 35 36 #define heap_create(heap, opts) (0); 37 #define heap_error(err_code) (NULL) 38 #define heap_destroy(heap) (0) 39 #define heap_alloc(heap, size) (xmalloc (size)) 40 #define heap_strdup(heap, s) (xstrdup (s)) 41 #define heap_free(heap, p) (p ? xfree (p), NULL : NULL) 42 #define heap_realloc(heap, p, size) (realloc (p, size)) 43 #define heap_isempty(heap) (1) 44 45 #endif 46