xref: /openbsd-src/usr.bin/diff/xmalloc.h (revision 6f793eeffb48a4b8243f4c7f1f5be1ea245ea571)
1*6f793eefSmmcc /* $OpenBSD: xmalloc.h,v 1.4 2015/11/12 16:30:30 mmcc Exp $ */
24a034c3aSray 
34a034c3aSray /*
44a034c3aSray  * Author: Tatu Ylonen <ylo@cs.hut.fi>
54a034c3aSray  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
64a034c3aSray  *                    All rights reserved
74a034c3aSray  * Created: Mon Mar 20 22:09:17 1995 ylo
84a034c3aSray  *
94a034c3aSray  * Versions of malloc and friends that check their results, and never return
104a034c3aSray  * failure (they call fatal if they encounter an error).
114a034c3aSray  *
124a034c3aSray  * As far as I am concerned, the code I have written for this software
134a034c3aSray  * can be used freely for any purpose.  Any derived versions of this
144a034c3aSray  * software must be clearly marked as such, and if the derived work is
154a034c3aSray  * incompatible with the protocol description in the RFC file, it must be
164a034c3aSray  * called by a name other than "ssh" or "Secure Shell".
174a034c3aSray  */
184a034c3aSray 
194a034c3aSray #ifndef XMALLOC_H
204a034c3aSray #define XMALLOC_H
214a034c3aSray 
224a034c3aSray void	*xmalloc(size_t);
2357003866Sray void	*xcalloc(size_t, size_t);
24371275caSderaadt void	*xreallocarray(void *, size_t, size_t);
254a034c3aSray char	*xstrdup(const char *);
264a034c3aSray int	 xasprintf(char **, const char *, ...)
274a034c3aSray                 __attribute__((__format__ (printf, 2, 3)))
284a034c3aSray                 __attribute__((__nonnull__ (2)));
294a034c3aSray 
304a034c3aSray #endif	/* XMALLOC_H */
31