4da05d05c9
Signed-off-by: Chloe M. <chloe@mirocom.org>
25 lines
400 B
C
25 lines
400 B
C
/*
|
|
* Copyright (c) 2026, Chloe M.
|
|
* Provided under the BSD-3 clause
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stddef.h>
|
|
#include <assert.h>
|
|
#include "blobchain/memlib.h"
|
|
|
|
void *
|
|
xmalloc(size_t sz)
|
|
{
|
|
void *p;
|
|
|
|
assert(sz != 0 && "xmalloc size cannot be zero!");
|
|
if ((p = malloc(sz)) == NULL) {
|
|
printf("fatal: out of memory\n");
|
|
exit(1);
|
|
}
|
|
|
|
return p;
|
|
}
|