xref: /freebsd/contrib/bmake/make_malloc.h (revision 9f45a3c8c82ffead7044ae836d9257113c630d3b)
1*9f45a3c8SSimon J. Gerraty /*	$NetBSD: make_malloc.h,v 1.18 2021/12/15 11:01:39 rillig Exp $	*/
23955d011SMarcel Moolenaar 
3dba7b0efSSimon J. Gerraty /*
43955d011SMarcel Moolenaar  * Copyright (c) 2009 The NetBSD Foundation, Inc.
53955d011SMarcel Moolenaar  * All rights reserved.
63955d011SMarcel Moolenaar  *
73955d011SMarcel Moolenaar  * Redistribution and use in source and binary forms, with or without
83955d011SMarcel Moolenaar  * modification, are permitted provided that the following conditions
93955d011SMarcel Moolenaar  * are met:
103955d011SMarcel Moolenaar  * 1. Redistributions of source code must retain the above copyright
113955d011SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer.
123955d011SMarcel Moolenaar  * 2. Redistributions in binary form must reproduce the above copyright
133955d011SMarcel Moolenaar  *    notice, this list of conditions and the following disclaimer in the
143955d011SMarcel Moolenaar  *    documentation and/or other materials provided with the distribution.
153955d011SMarcel Moolenaar  *
163955d011SMarcel Moolenaar  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
173955d011SMarcel Moolenaar  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
183955d011SMarcel Moolenaar  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
193955d011SMarcel Moolenaar  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
203955d011SMarcel Moolenaar  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
213955d011SMarcel Moolenaar  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
223955d011SMarcel Moolenaar  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
233955d011SMarcel Moolenaar  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
243955d011SMarcel Moolenaar  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
253955d011SMarcel Moolenaar  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
263955d011SMarcel Moolenaar  * POSSIBILITY OF SUCH DAMAGE.
273955d011SMarcel Moolenaar  */
283955d011SMarcel Moolenaar 
293955d011SMarcel Moolenaar #ifndef USE_EMALLOC
30*9f45a3c8SSimon J. Gerraty void *bmake_malloc(size_t) MAKE_ATTR_USE;
31*9f45a3c8SSimon J. Gerraty void *bmake_realloc(void *, size_t) MAKE_ATTR_USE;
32*9f45a3c8SSimon J. Gerraty char *bmake_strdup(const char *) MAKE_ATTR_USE;
33*9f45a3c8SSimon J. Gerraty char *bmake_strldup(const char *, size_t) MAKE_ATTR_USE;
343955d011SMarcel Moolenaar #else
353955d011SMarcel Moolenaar #include <util.h>
36956e45f6SSimon J. Gerraty #define bmake_malloc(n)		emalloc(n)
37956e45f6SSimon J. Gerraty #define bmake_realloc(p, n)	erealloc(p, n)
38956e45f6SSimon J. Gerraty #define bmake_strdup(s)		estrdup(s)
39956e45f6SSimon J. Gerraty #define bmake_strldup(s, n)	estrndup(s, n)
403955d011SMarcel Moolenaar #endif
41956e45f6SSimon J. Gerraty 
42*9f45a3c8SSimon J. Gerraty char *bmake_strsedup(const char *, const char *) MAKE_ATTR_USE;
43