xref: /freebsd/contrib/ntp/include/isc/mem.h (revision 09a53ad8f1318c5daae6cfb19d97f4f6459f0013)
1 /*
2  * libntp local override of isc/mem.h to stub it out.
3  *
4  * include/isc is searched before any of the lib/isc include
5  * directories and should be used only for replacement NTP headers
6  * overriding headers of the same name under lib/isc.
7  *
8  * NOTE: this assumes the system malloc is thread-safe and does
9  *	 not use any normal lib/isc locking.
10  */
11 
12 /*
13  * Copyright (C) 2004-2009  Internet Systems Consortium, Inc. ("ISC")
14  * Copyright (C) 1997-2001  Internet Software Consortium.
15  *
16  * Permission to use, copy, modify, and/or distribute this software for any
17  * purpose with or without fee is hereby granted, provided that the above
18  * copyright notice and this permission notice appear in all copies.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
21  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
23  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
25  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26  * PERFORMANCE OF THIS SOFTWARE.
27  */
28 
29 /* $Id: mem.h,v 1.78.120.3 2009/02/11 03:07:01 jinmei Exp $ */
30 
31 #ifndef ISC_MEM_H
32 #define ISC_MEM_H 1
33 
34 #include <stdio.h>
35 
36 #include <isc/lang.h>
37 #include <isc/mutex.h>
38 #include <isc/platform.h>
39 #include <isc/types.h>
40 #include <isc/xml.h>
41 
42 #include <ntp_stdlib.h>
43 
44 
45 #define ISC_MEM_UNUSED_ARG(a)		((void)(a))
46 
47 #define isc_mem_allocate(c, cnt)	isc_mem_get(c, cnt)
48 #define isc_mem_get(c, cnt)		\
49 	( ISC_MEM_UNUSED_ARG(c),	emalloc(cnt) )
50 
51 #define isc_mem_reallocate(c, mem, cnt)	\
52 	( ISC_MEM_UNUSED_ARG(c),	erealloc((mem), cnt) )
53 
54 #define isc_mem_put(c, mem, cnt)	\
55 	( ISC_MEM_UNUSED_ARG(cnt),	isc_mem_free(c, (mem)) )
56 
57 #define isc_mem_free(c, mem)		\
58 	( ISC_MEM_UNUSED_ARG(c),	free(mem) )
59 
60 #define isc_mem_strdup(c, str)		\
61 	( ISC_MEM_UNUSED_ARG(c),	estrdup(str) )
62 
63 #define isc__mem_attach(src, ptgt)	do { *(ptgt) = (src); } while (0)
64 #define isc__mem_detach(c)		ISC_MEM_UNUSED_ARG(c)
65 #define isc__mem_printallactive(s)	fprintf((s), \
66 					"isc_mem_printallactive() stubbed.\n")
67 
68 #endif /* ISC_MEM_H */
69