[master] 7af001469 vcurses: move AC() and IC() macros to vcurses.h

Nils Goroll nils.goroll at uplex.de
Fri Feb 7 21:49:08 UTC 2025


commit 7af00146975db17247b7602b0dfce3ccf8090245
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Feb 7 20:38:08 2025 +0100

    vcurses: move AC() and IC() macros to vcurses.h
    
    AC() asserts that curses commands do not fail
    IC() ignores return values (just (void)x)

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index 2e7e7cea3..df40ae91b 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -56,14 +56,6 @@
 #include "vut.h"
 #include "vtim.h"
 
-#if 1
-#define AC(x) assert((x) != ERR)
-#define IC(x) (void)x
-#else
-#define AC(x) (void)x
-#define IC(x) (void)x
-#endif
-
 #define HIST_N 2000		/* how far back we remember */
 #define HIST_RES 100		/* bucket resolution */
 
diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 4d2c8077a..3022cb025 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -58,12 +58,6 @@
 #include "vut.h"
 #include "vapi/vsig.h"
 
-#if 0
-#define AC(x) assert((x) != ERR)
-#else
-#define AC(x) x
-#endif
-
 static struct VUT *vut;
 
 struct top {
diff --git a/include/vcurses.h b/include/vcurses.h
index 1bd756661..2ba4cf7e1 100644
--- a/include/vcurses.h
+++ b/include/vcurses.h
@@ -43,3 +43,11 @@
 #else
 #  error "SysV or X/Open-compatible Curses header file required"
 #endif
+
+#if 1
+#define AC(x) assert((x) != ERR)
+#define IC(x) (void)x
+#else
+#define AC(x) (void)x
+#define IC(x) (void)x
+#endif


More information about the varnish-commit mailing list