xmalloc.h 1.1 KB

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