1 /* tinyproxy - A fast light-weight HTTP proxy
2 * Copyright (C) 2002 Robert James Kaes <rjkaes@users.sourceforge.net>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 /* See 'heap.c' for detailed information. */
21 #ifndef TINYPROXY_HEAP_H
22 #define TINYPROXY_HEAP_H
25 * The following is to allow for better memory checking.
29 extern void *debugging_calloc (size_t nmemb, size_t size, const char *file,
31 extern void *debugging_malloc (size_t size, const char *file,
33 extern void debugging_free (void *ptr, const char *file, unsigned long line);
34 extern void *debugging_realloc (void *ptr, size_t size, const char *file,
36 extern char *debugging_strdup (const char *s, const char *file,
39 # define safecalloc(x, y) debugging_calloc(x, y, __FILE__, __LINE__)
40 # define safemalloc(x) debugging_malloc(x, __FILE__, __LINE__)
41 # define saferealloc(x, y) debugging_realloc(x, y, __FILE__, __LINE__)
42 # define safestrdup(x) debugging_strdup(x, __FILE__, __LINE__)
43 # define safefree(x) (debugging_free(x, __FILE__, __LINE__), *(&(x)) = NULL)
47 # define safecalloc(x, y) calloc(x, y)
48 # define safemalloc(x) malloc(x)
49 # define saferealloc(x, y) realloc(x, y)
50 # define safefree(x) (free (x), *(&(x)) = NULL)
51 # define safestrdup(x) strdup(x)
56 * Allocate memory from the "shared" region of memory.
58 extern void *malloc_shared_memory (size_t size);
59 extern void *calloc_shared_memory (size_t nmemb, size_t size);