]> git.itanic.dy.fi Git - sdl-planets/blobdiff - quadtree.c
quadtree.c: Print line number when trap is caught
[sdl-planets] / quadtree.c
index 80b285a6f6ba74584abc67bac63dd4c729753d5d..79039c64833c221480b49c6c1050ebe8d9d3593b 100644 (file)
@@ -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)
 {