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