diff gen.c @ 792:724bbec47f86

Use a new fatal_error function instead of calling fprintf and exit for fatal errors. This new function more gracefully handles the case in which BlastEm was not started from a terminal or disconnected from ther terminal (Windows).
author Michael Pavone <pavone@retrodev.com>
date Sat, 25 Jul 2015 18:22:07 -0700
parents c8fefa140c80
children a7774fc2de4b
line wrap: on
line diff
--- a/gen.c	Sat Jul 25 18:19:00 2015 -0700
+++ b/gen.c	Sat Jul 25 18:22:07 2015 -0700
@@ -2,14 +2,14 @@
 #include <stdlib.h>
 #include "gen.h"
 #include "mem.h"
+#include "util.h"
 
 void init_code_info(code_info *code)
 {
 	size_t size = CODE_ALLOC_SIZE;
 	code->cur = alloc_code(&size);
 	if (!code->cur) {
-		fputs("Failed to allocate memory for generated code\n", stderr);
-		exit(1);
+		fatal_error("Failed to allocate memory for generated code\n");
 	}
 	code->last = code->cur + size/sizeof(code_word) - RESERVE_WORDS;
 }