xref: /freebsd/crypto/openssh/xmalloc.h (revision 557f75e54ae47df936c7de8fb97ec70c4180a5c0)
1*557f75e5SDag-Erling Smørgrav /* $OpenBSD: xmalloc.h,v 1.15 2015/04/24 01:36:01 deraadt Exp $ */
2ae1f160dSDag-Erling Smørgrav 
3511b41d2SMark Murray /*
4511b41d2SMark Murray  * Author: Tatu Ylonen <ylo@cs.hut.fi>
5511b41d2SMark Murray  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6511b41d2SMark Murray  *                    All rights reserved
7511b41d2SMark Murray  * Created: Mon Mar 20 22:09:17 1995 ylo
8511b41d2SMark Murray  *
9511b41d2SMark Murray  * Versions of malloc and friends that check their results, and never return
10511b41d2SMark Murray  * failure (they call fatal if they encounter an error).
11511b41d2SMark Murray  *
12b66f2d16SKris Kennaway  * As far as I am concerned, the code I have written for this software
13b66f2d16SKris Kennaway  * can be used freely for any purpose.  Any derived versions of this
14b66f2d16SKris Kennaway  * software must be clearly marked as such, and if the derived work is
15b66f2d16SKris Kennaway  * incompatible with the protocol description in the RFC file, it must be
16b66f2d16SKris Kennaway  * called by a name other than "ssh" or "Secure Shell".
17511b41d2SMark Murray  */
18511b41d2SMark Murray 
19ae1f160dSDag-Erling Smørgrav void	*xmalloc(size_t);
20761efaa7SDag-Erling Smørgrav void	*xcalloc(size_t, size_t);
21*557f75e5SDag-Erling Smørgrav void	*xreallocarray(void *, size_t, size_t);
22ae1f160dSDag-Erling Smørgrav char	*xstrdup(const char *);
23761efaa7SDag-Erling Smørgrav int	 xasprintf(char **, const char *, ...)
24761efaa7SDag-Erling Smørgrav                 __attribute__((__format__ (printf, 2, 3)))
25761efaa7SDag-Erling Smørgrav                 __attribute__((__nonnull__ (2)));
26