diff options
| author | verdant <im@verdant.ee> | 2026-07-21 18:54:26 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-07-21 18:54:26 +0800 |
| commit | fe0b140cf436c1428baa371b809370903df9f47b (patch) | |
| tree | 83e58aee8ca084bccb487a34ebc23c33e23fe5f4 /mem.c | |
| parent | 3e4e10c1c1203d605aeceafa8f15e6a3a4aa8033 (diff) | |
| download | sf-fe0b140cf436c1428baa371b809370903df9f47b.tar.gz sf-fe0b140cf436c1428baa371b809370903df9f47b.zip | |
Add xmalloc
Diffstat (limited to 'mem.c')
| -rw-r--r-- | mem.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -0,0 +1,16 @@ +#include "mem.h" + +#include <curses.h> +#include <stddef.h> +#include <stdlib.h> + +#include "err.h" + +void *xmalloc(size_t size) { + void *rtn = malloc(size); + if (!rtn) { + endwin(); + die("Out of memory"); + } + return rtn; +} |
