From 835b293d35a209d38047126443d41fa7090daa4c Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 19 Jun 2017 21:20:57 +0200 Subject: Use our own variant of 'assert' and 'assert_perror'. Our variants print stack traces on failures. This will make locating errors much easier. --- console-client/ncursesw.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'console-client/ncursesw.c') diff --git a/console-client/ncursesw.c b/console-client/ncursesw.c index 881acad7..8e8962fd 100644 --- a/console-client/ncursesw.c +++ b/console-client/ncursesw.c @@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include #include #include #include @@ -324,7 +324,7 @@ input_loop (void *unused) console_exit (); break; case 23: /* ^W */ - assert (size < 100); + assert_backtrace (size < 100); buf[size++] = ret; break; case '1': @@ -397,7 +397,7 @@ input_loop (void *unused) { if (keycodes[i].cons) { - assert (size + assert_backtrace (size < 101 - strlen (keycodes[i].cons)); strcpy (&buf[size], keycodes[i].cons); size += strlen (keycodes[i].cons); @@ -408,7 +408,7 @@ input_loop (void *unused) } if (!found) { - assert (size < 100); + assert_backtrace (size < 100); buf[size++] = ret; } break; @@ -472,7 +472,7 @@ mvwputsn (conchar_t *str, size_t len, off_t x, off_t y) { printf ("setcchar failed: %s\n", strerror (errno)); printf ("[%lc]\n", wch[0]); - assert (!"Do something if setcchar fails."); + assert_backtrace (!"Do something if setcchar fails."); } #endif ret = wadd_wch (conspad, &chr); @@ -481,7 +481,7 @@ mvwputsn (conchar_t *str, size_t len, off_t x, off_t y) { printf ("add_wch failed: %i, %s\n", ret, strerror (errno)); printf ("[%lc]\n", wch[0]); - assert (!"Do something if add_wchr fails."); + assert_backtrace (!"Do something if add_wchr fails."); } #endif } @@ -505,7 +505,7 @@ static error_t ncursesw_set_cursor_pos (void *handle, uint32_t col, uint32_t row) { pthread_mutex_lock (&ncurses_lock); - assert (current_width && current_height); + assert_backtrace (current_width && current_height); if (autoscroll) { /* Autoscroll to the right. */ @@ -569,7 +569,7 @@ static error_t ncursesw_scroll (void *handle, int delta) { /* XXX We don't support scrollback for now. */ - assert (delta >= 0); + assert_backtrace (delta >= 0); pthread_mutex_lock (&ncurses_lock); idlok (conspad, TRUE); -- cgit v1.2.3