Mercurial > repos > blastem
diff tern.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 | 2f48a3c187c6 |
children | 110251ea369e |
line wrap: on
line diff
--- a/tern.c Sat Jul 25 18:19:00 2015 -0700 +++ b/tern.c Sat Jul 25 18:22:07 2015 -0700 @@ -8,6 +8,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include "util.h" tern_node * tern_insert(tern_node * head, char * key, tern_val value) { @@ -190,8 +191,7 @@ } if (head->el) { if (pos == MAX_ITER_KEY) { - fputs("exceeded maximum key size", stderr); - exit(1); + fatal_error("tern_foreach_int: exceeded maximum key size"); } keybuf[pos] = head->el; tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1);