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