This commit is contained in:
DarthMooMancer
2025-08-08 16:08:29 -04:00
parent 8738b54566
commit 5d4ec31a60
9 changed files with 105 additions and 306 deletions
+4 -13
View File
@@ -1,4 +1,3 @@
/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
@@ -7,9 +6,7 @@
#include "util.h"
void
die(const char *fmt, ...)
{
void die(const char *fmt, ...) {
va_list ap;
int saved_errno;
@@ -19,19 +16,13 @@ die(const char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end(ap);
if (fmt[0] && fmt[strlen(fmt)-1] == ':')
fprintf(stderr, " %s", strerror(saved_errno));
if (fmt[0] && fmt[strlen(fmt)-1] == ':') fprintf(stderr, " %s", strerror(saved_errno));
fputc('\n', stderr);
exit(1);
}
void *
ecalloc(size_t nmemb, size_t size)
{
void * ecalloc(size_t nmemb, size_t size) {
void *p;
if (!(p = calloc(nmemb, size)))
die("calloc:");
if (!(p = calloc(nmemb, size))) die("calloc:");
return p;
}