From: Ben Pfaff Date: Sat, 13 Mar 2010 18:59:09 +0000 (-0800) Subject: tab: Add debugging checks to tab_hline() to match those for tab_vline(). X-Git-Tag: v0.7.5~113 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5955409d3679873d3bd6a0056e2aef92fbb0258;p=pspp-builds.git 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. --- diff --git a/src/output/tab.c b/src/output/tab.c index 3092c043..f6b4886b 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;