util.c 328 B

12345678910111213141516
  1. /* See LICENSE file for copyright and license details. */
  2. #include "util.h"
  3. #include <errno.h>
  4. #include <stdarg.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. void *
  9. emallocz(unsigned int size) {
  10. void *res = calloc(1, size);
  11. if(!res)
  12. err(EXIT_FAILURE, "could not malloc() %u bytes\n", size);
  13. return res;
  14. }