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