[master] 4807f6a5e Polish

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Apr 1 07:49:07 UTC 2020


commit 4807f6a5e398bf5fbe3ea56f864c389e221a8de1
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Mar 5 10:44:46 2020 +0100

    Polish

diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c
index 9543448c5..6f303d5df 100644
--- a/bin/varnishstat/varnishstat_curses.c
+++ b/bin/varnishstat/varnishstat_curses.c
@@ -317,6 +317,17 @@ sample_data(void)
 	sample_hitrate();
 }
 
+static void
+destroy_window(WINDOW **w)
+{
+
+	AN(w);
+	if (*w == NULL)
+		return;
+	assert(delwin(*w) != ERR);
+	*w = NULL;
+}
+
 static void
 make_windows(void)
 {
@@ -324,26 +335,11 @@ make_windows(void)
 	int y;
 	int y_status, y_bar_t, y_points, y_bar_b, y_info;
 
-	if (w_status) {
-		delwin(w_status);
-		w_status = NULL;
-	}
-	if (w_bar_t) {
-		delwin(w_bar_t);
-		w_bar_t = NULL;
-	}
-	if (w_points) {
-		delwin(w_points);
-		w_points = NULL;
-	}
-	if (w_bar_b) {
-		delwin(w_bar_b);
-		w_bar_b = NULL;
-	}
-	if (w_info) {
-		delwin(w_info);
-		w_info = NULL;
-	}
+	destroy_window(&w_status);
+	destroy_window(&w_bar_t);
+	destroy_window(&w_points);
+	destroy_window(&w_bar_b);
+	destroy_window(&w_info);
 
 	Y = LINES;
 	X = COLS;


More information about the varnish-commit mailing list