blob: cf38ddfa48c5c4bff6b031ca800b6a2b6f745d6d [file] [log] [blame]
deraadt@openbsd.org9e509d42017-05-31 09:15:42 +00001/* $OpenBSD: xmalloc.h,v 1.17 2017/05/31 09:15:42 deraadt Exp $ */
Ben Lindstrom05764b92002-03-05 01:53:02 +00002
Damien Millerd4a8b7e1999-10-27 13:42:43 +10003/*
Damien Miller95def091999-11-25 00:26:21 +11004 * Author: Tatu Ylonen <ylo@cs.hut.fi>
Damien Miller95def091999-11-25 00:26:21 +11005 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
6 * All rights reserved
Damien Miller95def091999-11-25 00:26:21 +11007 * Created: Mon Mar 20 22:09:17 1995 ylo
Damien Miller4af51302000-04-16 11:18:38 +10008 *
Damien Miller95def091999-11-25 00:26:21 +11009 * Versions of malloc and friends that check their results, and never return
10 * failure (they call fatal if they encounter an error).
Damien Miller4af51302000-04-16 11:18:38 +100011 *
Damien Millere4340be2000-09-16 13:29:08 +110012 * As far as I am concerned, the code I have written for this software
13 * can be used freely for any purpose. Any derived versions of this
14 * software must be clearly marked as such, and if the derived work is
15 * incompatible with the protocol description in the RFC file, it must be
16 * called by a name other than "ssh" or "Secure Shell".
Damien Miller95def091999-11-25 00:26:21 +110017 */
Damien Millerd4a8b7e1999-10-27 13:42:43 +100018
dtucker@openbsd.orgffb1e7e2016-02-15 09:47:49 +000019void ssh_malloc_init(void);
Ben Lindstrom4cc240d2001-07-04 04:46:56 +000020void *xmalloc(size_t);
Damien Miller07d86be2006-03-26 14:19:21 +110021void *xcalloc(size_t, size_t);
deraadt@openbsd.org657a5fb2015-04-24 01:36:00 +000022void *xreallocarray(void *, size_t, size_t);
deraadt@openbsd.org9e509d42017-05-31 09:15:42 +000023void *xrecallocarray(void *, size_t, size_t, size_t);
Ben Lindstromcb72e4f2002-06-21 00:41:51 +000024char *xstrdup(const char *);
Damien Miller07d86be2006-03-26 14:19:21 +110025int xasprintf(char **, const char *, ...)
26 __attribute__((__format__ (printf, 2, 3)))
27 __attribute__((__nonnull__ (2)));