svn commit: trunk/busybox/procps

vda at busybox.net vda at busybox.net
Sat Sep 8 17:21:02 UTC 2007


Author: vda
Date: 2007-09-08 10:21:01 -0700 (Sat, 08 Sep 2007)
New Revision: 19803

Log:
top: add sizeof(G) check; fix style



Modified:
   trunk/busybox/procps/top.c


Changeset:
Modified: trunk/busybox/procps/top.c
===================================================================
--- trunk/busybox/procps/top.c	2007-09-08 16:51:19 UTC (rev 19802)
+++ trunk/busybox/procps/top.c	2007-09-08 17:21:01 UTC (rev 19803)
@@ -85,6 +85,12 @@
 #endif
 };
 #define G (*(struct globals*)&bb_common_bufsiz1)
+#define INIT_G() \
+	do { \
+		struct G_sizecheck { \
+			char G_sizecheck[sizeof(G) > COMMON_BUFSIZE ? -1 : 1]; \
+		}; \
+	} while (0)
 #define top              (G.top               )
 #define ntop             (G.ntop              )
 #define sort_field       (G.sort_field        )
@@ -512,21 +518,10 @@
 }
 #endif /* FEATURE_USE_TERMIOS */
 
+/*
+ * TOPMEM support
+ */
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 typedef unsigned long mem_t;
 
 typedef struct topmem_status_t {
@@ -766,21 +761,10 @@
 int topmem_sort(char *a, char *b);
 #endif /* TOPMEM */
 
+/*
+ * end TOPMEM support
+ */
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 enum {
 	TOP_MASK = 0
 		| PSSCAN_PID
@@ -802,7 +786,7 @@
 {
 	int count, lines, col;
 	unsigned interval;
-	int iterations = 0; /* infinite */
+	int iterations;
 	char *sinterval, *siterations;
 	SKIP_FEATURE_TOPMEM(const) unsigned scan_mask = TOP_MASK;
 #if ENABLE_FEATURE_USE_TERMIOS
@@ -814,7 +798,10 @@
 	pfd[0].events = POLLIN;
 #endif /* FEATURE_USE_TERMIOS */
 
+	INIT_G();
+
 	interval = 5; /* default update rate is 5 seconds */
+	iterations = 0; /* infinite */
 
 	/* do normal option parsing */
 	opt_complementary = "-";
@@ -852,8 +839,7 @@
 	while (1) {
 		procps_status_t *p = NULL;
 
-		/* Default */
-		lines = 24;
+		lines = 24; /* default */
 		col = 79;
 #if ENABLE_FEATURE_USE_TERMIOS
 		get_terminal_width_height(0, &col, &lines);




More information about the busybox-cvs mailing list