diff options
author | Camil Staps | 2016-08-25 11:16:49 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-25 11:16:49 +0200 |
commit | 7d9b5a0c84a931542c088cfe6bc4325be22ecb71 (patch) | |
tree | 085e5ae27cfbabc2e1533f4927969f5784dd1cfc /compiler/error.c |
Initial commit
Diffstat (limited to 'compiler/error.c')
-rw-r--r-- | compiler/error.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/error.c b/compiler/error.c new file mode 100644 index 0000000..7d70f60 --- /dev/null +++ b/compiler/error.c @@ -0,0 +1,16 @@ +#include "error.h" + +#include <stdio.h> +#include <stdlib.h> + +void error(int code, char* message) { + if (message) { + fprintf(stderr, "%s\n", message); + } + + exit(code); +} + +void error_no_mem(void) { + error(ERROR_NO_MEMORY, "No memory"); +} |