xref: /dflybsd-src/contrib/bmake/make_malloc.h (revision 9e7ae5a0527a977cab412aede3a532cfe2903bbb)
1*6eef5f0cSAntonio Huete Jimenez /*	$NetBSD: make_malloc.h,v 1.18 2021/12/15 11:01:39 rillig Exp $	*/
201e196c8SJohn Marino 
3a34d5fb1SAntonio Huete Jimenez /*
401e196c8SJohn Marino  * Copyright (c) 2009 The NetBSD Foundation, Inc.
501e196c8SJohn Marino  * All rights reserved.
601e196c8SJohn Marino  *
701e196c8SJohn Marino  * Redistribution and use in source and binary forms, with or without
801e196c8SJohn Marino  * modification, are permitted provided that the following conditions
901e196c8SJohn Marino  * are met:
1001e196c8SJohn Marino  * 1. Redistributions of source code must retain the above copyright
1101e196c8SJohn Marino  *    notice, this list of conditions and the following disclaimer.
1201e196c8SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
1301e196c8SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
1401e196c8SJohn Marino  *    documentation and/or other materials provided with the distribution.
1501e196c8SJohn Marino  *
1601e196c8SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1701e196c8SJohn Marino  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1801e196c8SJohn Marino  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1901e196c8SJohn Marino  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2001e196c8SJohn Marino  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2101e196c8SJohn Marino  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2201e196c8SJohn Marino  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2301e196c8SJohn Marino  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2401e196c8SJohn Marino  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2501e196c8SJohn Marino  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2601e196c8SJohn Marino  * POSSIBILITY OF SUCH DAMAGE.
2701e196c8SJohn Marino  */
2801e196c8SJohn Marino 
2901e196c8SJohn Marino #ifndef USE_EMALLOC
30*6eef5f0cSAntonio Huete Jimenez void *bmake_malloc(size_t) MAKE_ATTR_USE;
31*6eef5f0cSAntonio Huete Jimenez void *bmake_realloc(void *, size_t) MAKE_ATTR_USE;
32*6eef5f0cSAntonio Huete Jimenez char *bmake_strdup(const char *) MAKE_ATTR_USE;
33*6eef5f0cSAntonio Huete Jimenez char *bmake_strldup(const char *, size_t) MAKE_ATTR_USE;
3401e196c8SJohn Marino #else
3501e196c8SJohn Marino #include <util.h>
36a34d5fb1SAntonio Huete Jimenez #define bmake_malloc(n)		emalloc(n)
37a34d5fb1SAntonio Huete Jimenez #define bmake_realloc(p, n)	erealloc(p, n)
38a34d5fb1SAntonio Huete Jimenez #define bmake_strdup(s)		estrdup(s)
39a34d5fb1SAntonio Huete Jimenez #define bmake_strldup(s, n)	estrndup(s, n)
4001e196c8SJohn Marino #endif
4101e196c8SJohn Marino 
42*6eef5f0cSAntonio Huete Jimenez char *bmake_strsedup(const char *, const char *) MAKE_ATTR_USE;
43