summaryrefslogtreecommitdiff
path: root/console-client/ncursesw.c
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /console-client/ncursesw.c
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'console-client/ncursesw.c')
-rw-r--r--console-client/ncursesw.c16
1 files changed, 8 insertions, 8 deletions
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 <assert.h>
+#include <assert-backtrace.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
@@ -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);