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