From a5955409d3679873d3bd6a0056e2aef92fbb0258 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 13 Mar 2010 10:59:09 -0800 Subject: [PATCH] tab: Add debugging checks to tab_hline() to match those for tab_vline(). I'm not sure that this is really a good approach, but we might as well be consistent. --- src/output/tab.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/output/tab.c b/src/output/tab.c index 3092c04372..f6b4886b1f 100644 --- a/src/output/tab.c +++ b/src/output/tab.c @@ -236,6 +236,21 @@ tab_vline (struct tab_table *t, int style, int x, int y1, int y2) void tab_hline (struct tab_table * t, int style, int x1, int x2, int y) { +#if DEBUGGING + if (y + t->row_ofs < 0 || y + t->row_ofs > tab_nr (t) + || x1 + t->col_ofs < 0 || x1 + t->col_ofs >= tab_nc (t) + || x2 + t->col_ofs < 0 || x2 + t->col_ofs >= tab_nc (t)) + { + printf (_("bad hline: x=(%d+%d=%d,%d+%d=%d) y=%d+%d=%d in " + "table size (%d,%d)\n"), + x1, t->col_ofs, x1 + t->col_ofs, + x2, t->col_ofs, x2 + t->col_ofs, + y, t->row_ofs, y + t->row_ofs, + tab_nc (t), tab_nr (t)); + return; + } +#endif + x1 += t->col_ofs; x2 += t->col_ofs; y += t->row_ofs; -- 2.30.2