gbasys
diff src/error.c @ 11:2b31bd7e96b4
added panicf
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 01 Feb 2016 02:36:25 +0200 |
parents | 72c6429ae953 |
children |
line diff
1.1 --- a/src/error.c Sat Jan 30 05:23:48 2016 +0200 1.2 +++ b/src/error.c Mon Feb 01 02:36:25 2016 +0200 1.3 @@ -1,6 +1,6 @@ 1.4 /* 1.5 gbasys - a gameboy advance hardware abstraction library 1.6 -Copyright (C) 2004-2014 John Tsiombikas <nuclear@member.fsf.org> 1.7 +Copyright (C) 2004-2016 John Tsiombikas <nuclear@member.fsf.org> 1.8 1.9 This program is free software: you can redistribute it and/or modify 1.10 it under the terms of the GNU General Public License as published by 1.11 @@ -15,6 +15,8 @@ 1.12 You should have received a copy of the GNU General Public License 1.13 along with this program. If not, see <http://www.gnu.org/licenses/>. 1.14 */ 1.15 +#include <stdio.h> 1.16 +#include <stdarg.h> 1.17 #include "gfx.h" 1.18 1.19 void panic(const char *str) { 1.20 @@ -28,3 +30,15 @@ 1.21 1.22 for(;;); 1.23 } 1.24 + 1.25 +void panicf(const char *fmt, ...) 1.26 +{ 1.27 + static char buf[64]; 1.28 + va_list ap; 1.29 + 1.30 + va_start(ap, fmt); 1.31 + vsnprintf(buf, sizeof buf - 1, fmt, ap); 1.32 + va_end(ap); 1.33 + 1.34 + panic(buf); 1.35 +}