xref: /openbsd-src/usr.bin/file/xmalloc.h (revision 6d42169eec9bde30db4a01274d6ae9f9a3349815)
1*6d42169eStobias /* $OpenBSD: xmalloc.h,v 1.3 2015/11/17 18:25:03 tobias Exp $ */
2ff772f70Snicm 
3ff772f70Snicm /*
4ff772f70Snicm  * Author: Tatu Ylonen <ylo@cs.hut.fi>
5ff772f70Snicm  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6ff772f70Snicm  *                    All rights reserved
7ff772f70Snicm  * Created: Mon Mar 20 22:09:17 1995 ylo
8ff772f70Snicm  *
9ff772f70Snicm  * Versions of malloc and friends that check their results, and never return
10ff772f70Snicm  * failure (they call fatal if they encounter an error).
11ff772f70Snicm  *
12ff772f70Snicm  * As far as I am concerned, the code I have written for this software
13ff772f70Snicm  * can be used freely for any purpose.  Any derived versions of this
14ff772f70Snicm  * software must be clearly marked as such, and if the derived work is
15ff772f70Snicm  * incompatible with the protocol description in the RFC file, it must be
16ff772f70Snicm  * called by a name other than "ssh" or "Secure Shell".
17ff772f70Snicm  */
18ff772f70Snicm 
19ff772f70Snicm #ifndef XMALLOC_H
20ff772f70Snicm #define XMALLOC_H
21ff772f70Snicm 
22ff772f70Snicm void	*xmalloc(size_t);
23ff772f70Snicm void	*xcalloc(size_t, size_t);
24ff772f70Snicm void	*xreallocarray(void *, size_t, size_t);
25ff772f70Snicm char	*xstrdup(const char *);
26ff772f70Snicm int	 xasprintf(char **, const char *, ...)
27ff772f70Snicm                 __attribute__((__format__ (printf, 2, 3)))
28ff772f70Snicm                 __attribute__((__nonnull__ (2)));
29ff772f70Snicm 
30ff772f70Snicm #endif	/* XMALLOC_H */
31