-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgen.c
More file actions
39 lines (35 loc) · 661 Bytes
/
gen.c
File metadata and controls
39 lines (35 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* gen.c: Copyright (C) 2011-2022 by Brian Raiter <[email protected]>
* License GPLv2+: GNU GPL version 2 or later.
*/
#include <stdio.h>
#include <stdlib.h>
#include "gen.h"
/* Wrapper for malloc().
*/
void *allocate(size_t size)
{
void *p;
p = malloc(size);
if (!p) {
fputs("Out of memory.\n", stderr);
exit(EXIT_FAILURE);
}
return p;
}
/* Wrapper for realloc().
*/
void *reallocate(void *p, size_t size)
{
p = realloc(p, size);
if (!p) {
fputs("Out of memory.\n", stderr);
exit(EXIT_FAILURE);
}
return p;
}
/* Wrapper for free().
*/
void deallocate(void *p)
{
free(p);
}