xref: /openbsd-src/usr.bin/sort/mem.h (revision de2b9554e7f861bdf604bbd7efe24dcbe27a4aef)
1*de2b9554Smillert /*	$OpenBSD: mem.h,v 1.4 2015/04/01 22:24:02 millert Exp $	*/
279428148Smillert 
379428148Smillert /*-
479428148Smillert  * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
579428148Smillert  * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com>
679428148Smillert  * All rights reserved.
779428148Smillert  *
879428148Smillert  * Redistribution and use in source and binary forms, with or without
979428148Smillert  * modification, are permitted provided that the following conditions
1079428148Smillert  * are met:
1179428148Smillert  * 1. Redistributions of source code must retain the above copyright
1279428148Smillert  *    notice, this list of conditions and the following disclaimer.
1379428148Smillert  * 2. Redistributions in binary form must reproduce the above copyright
1479428148Smillert  *    notice, this list of conditions and the following disclaimer in the
1579428148Smillert  *    documentation and/or other materials provided with the distribution.
1679428148Smillert  *
1779428148Smillert  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1879428148Smillert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1979428148Smillert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2079428148Smillert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2179428148Smillert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2279428148Smillert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2379428148Smillert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2479428148Smillert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2579428148Smillert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2679428148Smillert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2779428148Smillert  * SUCH DAMAGE.
2879428148Smillert  */
2979428148Smillert 
3079428148Smillert #if !defined(__SORT_MEM_H__)
3179428148Smillert #define	__SORT_MEM_H__
3279428148Smillert 
3379428148Smillert #include <errno.h>
347c91f203Smillert #include <stdarg.h>
3579428148Smillert #include <stdbool.h>
3679428148Smillert #include <stdlib.h>
3779428148Smillert 
3879428148Smillert /*
3979428148Smillert  * mem.c
4079428148Smillert  */
418fd2d339Smillert void *sort_calloc(size_t nmemb, size_t size);
4279428148Smillert void *sort_malloc(size_t);
4379428148Smillert void sort_free(void *ptr);
4479428148Smillert void *sort_reallocarray(void *, size_t, size_t);
4579428148Smillert char *sort_strdup(const char *);
467c91f203Smillert int sort_asprintf(char **, const char *, ...);
4779428148Smillert 
4879428148Smillert #endif /* __SORT_MEM_H__ */
49