From: Timo Kokkonen Date: Tue, 7 Dec 2010 19:57:00 +0000 (+0200) Subject: quadtree.c: Print line number when trap is caught X-Git-Url: http://git.itanic.dy.fi/?p=sdl-planets;a=commitdiff_plain;h=3b5d2b7da06c32b15d2a524f84974081b233da50 quadtree.c: Print line number when trap is caught This helps debugging Signed-off-by: Timo Kokkonen --- diff --git a/quadtree.c b/quadtree.c index 80b285a..79039c6 100644 --- a/quadtree.c +++ b/quadtree.c @@ -9,12 +9,18 @@ #define debug 0 #endif -static void trap(void) +static void _trap(int line) { - if (debug) + if (debug) { + printf("Trapped from line %d, use debugger to get backtrace\n", + line); + fflush(stdout); exit(1); + } } +#define trap() _trap(__LINE__) + static int quadtree_compare_coord(const struct vector *a, const struct vector *b) {