Add the debugging aid to Assert Curses return codes

taken from varnishtop. NOOP because #if 0'd
parent 8e45ba9f
...@@ -57,6 +57,12 @@ ...@@ -57,6 +57,12 @@
#include "vtim.h" #include "vtim.h"
#include "vapi/vsig.h" #include "vapi/vsig.h"
#if 0
#define AC(x) assert((x) != ERR)
#else
#define AC(x) x
#endif
#define HIST_N 2000 /* how far back we remember */ #define HIST_N 2000 /* how far back we remember */
#define HIST_RES 100 /* bucket resolution */ #define HIST_RES 100 /* bucket resolution */
...@@ -146,7 +152,7 @@ update(void) ...@@ -146,7 +152,7 @@ update(void)
int i, j; int i, j;
unsigned k, l; unsigned k, l;
erase(); AC(erase());
/* Draw horizontal axis */ /* Draw horizontal axis */
for (k = 0; k < n; ++k) for (k = 0; k < n; ++k)
...@@ -199,7 +205,7 @@ update(void) ...@@ -199,7 +205,7 @@ update(void)
(void)mvaddch((LINES - 3) - l, k, '|'); (void)mvaddch((LINES - 3) - l, k, '|');
} }
refresh(); AC(refresh());
} }
inline static void inline static void
...@@ -380,12 +386,12 @@ do_curses(void *arg) ...@@ -380,12 +386,12 @@ do_curses(void *arg)
(void)arg; (void)arg;
initscr(); initscr();
raw(); AC(raw());
noecho(); AC(noecho());
nonl(); AC(nonl());
intrflush(stdscr, FALSE); AC(intrflush(stdscr, FALSE));
curs_set(0); AC(curs_set(0));
erase(); AC(erase());
while (!VSIG_int && !VSIG_term && !VSIG_hup) { while (!VSIG_int && !VSIG_term && !VSIG_hup) {
AZ(pthread_mutex_lock(&mtx)); AZ(pthread_mutex_lock(&mtx));
update(); update();
...@@ -398,16 +404,16 @@ do_curses(void *arg) ...@@ -398,16 +404,16 @@ do_curses(void *arg)
break; break;
#ifdef KEY_RESIZE #ifdef KEY_RESIZE
case KEY_RESIZE: case KEY_RESIZE:
erase(); AC(erase());
break; break;
#endif #endif
case '\014': /* Ctrl-L */ case '\014': /* Ctrl-L */
case '\024': /* Ctrl-T */ case '\024': /* Ctrl-T */
redrawwin(stdscr); redrawwin(stdscr);
refresh(); AC(refresh());
break; break;
case '\032': /* Ctrl-Z */ case '\032': /* Ctrl-Z */
endwin(); AC(endwin());
AZ(raise(SIGTSTP)); AZ(raise(SIGTSTP));
break; break;
case '\003': /* Ctrl-C */ case '\003': /* Ctrl-C */
...@@ -441,7 +447,7 @@ do_curses(void *arg) ...@@ -441,7 +447,7 @@ do_curses(void *arg)
/* see below */ /* see below */
break; break;
default: default:
beep(); AC(beep());
break; break;
} }
...@@ -459,7 +465,7 @@ do_curses(void *arg) ...@@ -459,7 +465,7 @@ do_curses(void *arg)
AZ(pthread_mutex_unlock(&mtx)); AZ(pthread_mutex_unlock(&mtx));
} }
} }
endwin(); AC(endwin());
return (NULL); return (NULL);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment