diff options
| author | Simon Tatham <anakin@pobox.com> | 2017-05-18 06:46:55 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2017-05-18 06:46:55 +0100 |
| commit | 9e3e915426cb9ef8fd6f6689e12affb6288c5a8a (patch) | |
| tree | 2da97d3419ee15fd0c0089d81d89bf74aeb26961 /memory.c | |
| parent | ca59ebf60df4ef45a1e4d681980e29e3db853bba (diff) | |
| download | wix-on-linux-9e3e915426cb9ef8fd6f6689e12affb6288c5a8a.tar.gz wix-on-linux-9e3e915426cb9ef8fd6f6689e12affb6288c5a8a.tar.bz2 wix-on-linux-9e3e915426cb9ef8fd6f6689e12affb6288c5a8a.zip | |
Move snew/sfree out into their own header+src.
Diffstat (limited to 'memory.c')
| -rw-r--r-- | memory.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/memory.c b/memory.c new file mode 100644 index 0000000..7d3a746 --- /dev/null +++ b/memory.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include <err.h> | ||
| 2 | |||
| 3 | #include "memory.h" | ||
| 4 | |||
| 5 | void *smalloc(size_t size) | ||
| 6 | { | ||
| 7 | void *toret = malloc(size); | ||
| 8 | if (!toret) | ||
| 9 | errx(1, "out of memory"); | ||
| 10 | return toret; | ||
| 11 | } | ||
| 12 | |||
| 13 | void *srealloc(void *ptr, size_t size) | ||
| 14 | { | ||
| 15 | void *toret = realloc(ptr, size); | ||
| 16 | if (!toret) | ||
| 17 | errx(1, "out of memory"); | ||
| 18 | return toret; | ||
| 19 | } | ||
