Add.
[gnutls.git] / lib / gnutls_mem.h
bloba22d0f2fc324d021ccbd51fd5ff9700e73d85907
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation
4 * Author: Nikos Mavroyanopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA
25 #ifndef GNUTLS_MEM_H
26 # define GNUTLS_MEM_H
28 #ifdef USE_DMALLOC
29 # include <dmalloc.h>
30 #endif
32 typedef void svoid; /* for functions that allocate using gnutls_secure_malloc */
34 /* Use gnutls_afree() when calling alloca, or
35 * memory leaks may occur in systems which do not
36 * support alloca.
38 #ifdef USE_EFENCE
39 # define gnutls_alloca gnutls_malloc
40 # define gnutls_afree gnutls_free
41 #endif
43 #ifdef HAVE_ALLOCA
44 # ifdef HAVE_ALLOCA_H
45 # include <alloca.h>
46 # endif
47 # ifndef gnutls_alloca
48 # define gnutls_alloca alloca
49 # define gnutls_afree(x)
50 # endif
51 #else
52 # ifndef gnutls_alloca
53 # define gnutls_alloca gnutls_malloc
54 # define gnutls_afree gnutls_free
55 # endif
56 #endif /* HAVE_ALLOCA */
58 extern int (*_gnutls_is_secure_memory) (const void *);
60 /* this realloc function will return ptr if size==0, and
61 * will free the ptr if the new allocation failed.
63 void *gnutls_realloc_fast (void *ptr, size_t size);
65 svoid *gnutls_secure_calloc (size_t nmemb, size_t size);
67 void *_gnutls_calloc (size_t nmemb, size_t size);
68 char *_gnutls_strdup (const char *);
70 #endif /* GNUTLS_MEM_H */