xref: /openbsd-src/usr.bin/diff/xmalloc.h (revision 57003866bf9d794e291e4f346ca84d4e954c9f0d)
1*57003866Sray /* $OpenBSD: xmalloc.h,v 1.2 2009/06/07 08:39:13 ray 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);
23*57003866Sray void	*xcalloc(size_t, size_t);
244a034c3aSray void	*xrealloc(void *, size_t, size_t);
254a034c3aSray void     xfree(void *);
264a034c3aSray char	*xstrdup(const char *);
274a034c3aSray int	 xasprintf(char **, const char *, ...)
284a034c3aSray                 __attribute__((__format__ (printf, 2, 3)))
294a034c3aSray                 __attribute__((__nonnull__ (2)));
304a034c3aSray 
314a034c3aSray #endif	/* XMALLOC_H */
32