]> granicus.if.org Git - procps-ng/commitdiff
top: some imbedded literals are now manifest constants
authorJim Warner <james.warner@comcast.net>
Wed, 18 May 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Fri, 20 May 2022 06:23:19 +0000 (16:23 +1000)
A commit that changes no code but, hopefully, helps to
better document where and how such literals were used.

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 03d6544686735ed90596b4906be8ee5361fd9b3d..a9d4eb2295ab05856b4c751adcb69824d8475733 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -111,6 +111,13 @@ static int   Screen_cols, Screen_rows, Max_lines;
 #define      BOT_MISC_NS  +1           // data for namespaces req'd
 #ifdef BOT_MENU_YES
 # define     BOT_MENU_ON  -2           // in menu, tab focus active
+#endif
+        // next 4 are used when toggling window contents
+#define      BOT_SEP_CMA  ','
+#define      BOT_SEP_SLS  '/'
+#define      BOT_SEP_SPC  ' '
+#ifdef BOT_MENU_YES
+#define      BOT_SEP_TAB  '\t'
 #endif
         // 1 for horizontal separator
 #define      BOT_RSVD  1
@@ -5183,7 +5190,7 @@ static void bot_pick_toggle (void) {
    if (Bot_what == BOT_MENU_ON) {
       BOT_TOSS;
    } else {
-      Bot_sep = '\t';
+      Bot_sep = BOT_SEP_TAB;
       Bot_what = BOT_MENU_ON;
       Bot_indx = 0;
       Bot_item[0] = BOT_DELIMIT;
@@ -5570,7 +5577,7 @@ static void keys_global (int ch) {
 #endif
          break;
       case kbd_CtrlG:
-         bot_item_toggle(EU_CGR, "control groups", '/');
+         bot_item_toggle(EU_CGR, "control groups", BOT_SEP_SLS);
          break;
 #ifdef BOT_MENU_YES
       case kbd_CtrlH:
@@ -5585,10 +5592,10 @@ static void keys_global (int ch) {
          }
          break;
       case kbd_CtrlK:
-         bot_item_toggle(eu_CMDLINE_V, "command line", ' ');
+         bot_item_toggle(eu_CMDLINE_V, "command line", BOT_SEP_SPC);
          break;
       case kbd_CtrlN:
-         bot_item_toggle(eu_ENVIRON_V, "environment", ' ');
+         bot_item_toggle(eu_ENVIRON_V, "environment", BOT_SEP_SPC);
          break;
       case kbd_CtrlP:
          bot_misc_toggle(BOT_MISC_NS, ',');
@@ -5620,7 +5627,7 @@ static void keys_global (int ch) {
          }
          break;
       case kbd_CtrlU:
-         bot_item_toggle(EU_SGN, "supplementary groups", ',');
+         bot_item_toggle(EU_SGN, "supplementary groups", BOT_SEP_CMA);
          break;
       case kbd_BTAB:
          if (Bot_what) {