xref: /dflybsd-src/crypto/openssh/xmalloc.h (revision 50a69bb51183a7916e776f2c9f5fa64c999f1a2f)
1*50a69bb5SSascha Wildner /* $OpenBSD: xmalloc.h,v 1.20 2021/04/03 06:18:41 djm Exp $ */
218de8d7fSPeter Avalos 
318de8d7fSPeter Avalos /*
418de8d7fSPeter Avalos  * Author: Tatu Ylonen <ylo@cs.hut.fi>
518de8d7fSPeter Avalos  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
618de8d7fSPeter Avalos  *                    All rights reserved
718de8d7fSPeter Avalos  * Created: Mon Mar 20 22:09:17 1995 ylo
818de8d7fSPeter Avalos  *
918de8d7fSPeter Avalos  * Versions of malloc and friends that check their results, and never return
1018de8d7fSPeter Avalos  * failure (they call fatal if they encounter an error).
1118de8d7fSPeter Avalos  *
1218de8d7fSPeter Avalos  * As far as I am concerned, the code I have written for this software
1318de8d7fSPeter Avalos  * can be used freely for any purpose.  Any derived versions of this
1418de8d7fSPeter Avalos  * software must be clearly marked as such, and if the derived work is
1518de8d7fSPeter Avalos  * incompatible with the protocol description in the RFC file, it must be
1618de8d7fSPeter Avalos  * called by a name other than "ssh" or "Secure Shell".
1718de8d7fSPeter Avalos  */
1818de8d7fSPeter Avalos 
1918de8d7fSPeter Avalos void	*xmalloc(size_t);
2018de8d7fSPeter Avalos void	*xcalloc(size_t, size_t);
21e9778795SPeter Avalos void	*xreallocarray(void *, size_t, size_t);
22ce74bacaSMatthew Dillon void	*xrecallocarray(void *, size_t, size_t, size_t);
2318de8d7fSPeter Avalos char	*xstrdup(const char *);
2418de8d7fSPeter Avalos int	 xasprintf(char **, const char *, ...)
25*50a69bb5SSascha Wildner     __attribute__((__format__ (printf, 2, 3))) __attribute__((__nonnull__ (2)));
260cbfa66cSDaniel Fojt int	 xvasprintf(char **, const char *, va_list)
270cbfa66cSDaniel Fojt     __attribute__((__nonnull__ (2)));
28