]> granicus.if.org Git - procps-ng/commitdiff
top: eliminate all superfluous cruft under the new API
authorJim Warner <james.warner@comcast.net>
Tue, 1 Dec 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Sat, 12 Mar 2016 03:53:36 +0000 (14:53 +1100)
This commit is just a cleanup of some extraneous cruft
left after the newlib migrations and summarized below:

. whack the 2nd line of what was an eliminated comment

. eliminated reference to NUM_NS and thus that need to
include the otherwise defunct 'readproc.h' header file

. reference to Frame_maxtask made properly generalized

. all former sort support #define's are now eliminated

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

index 22a151c292c53b7efdfefd767dbe3c1464bca5b4..d0ce0ecd20dacd17d58d7d831ddfe8817dddc675 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -171,7 +171,6 @@ static WIN_t *Curwin;
            [ 'Frames_...' (plural) stuff persists beyond 1 frame ]
            [ or are used in response to async signals received ! ] */
 static volatile int Frames_signal;     // time to rebuild all column headers
-                                       // ie. current 'size' of proc table
 static float        Frame_etscale;     // so we can '*' vs. '/' WHEN 'pcpu'
 
         /* Support for automatically sized fixed-width column expansions.
@@ -2142,7 +2141,7 @@ static void zap_fieldstab (void) {
          = Rc.fixed_widest ? 8 + Rc.fixed_widest : 8;
       Fieldstab[EU_WCH].width
          = Rc.fixed_widest ? 10 + Rc.fixed_widest : 10;
-      for (i = EU_NS1; i < EU_NS1 + NUM_NS; i++)
+      for (i = EU_NS1; i <= EU_NS6; i++)
          Fieldstab[i].width
             = Rc.fixed_widest ? 10 + Rc.fixed_widest : 10;
    }
index b9dda6e25a2771a6447947ef7ab2146364e0c3bd..22a14ee59be7b485fbd63628a732405b4e613a9c 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -22,7 +22,6 @@
 
 #include <proc/pids.h>
 #include <proc/readstat.h>
-#include "../proc/readproc.h"
 
         /* Defines represented in configure.ac ----------------------------- */
 //#define BOOST_PERCNT            /* enable extra precision for two % fields */
@@ -326,7 +325,7 @@ typedef struct WIN_t {
           totpflgs,        // total of displayable procflgs in pflgsall array
           begpflg,         // scrolled beginning pos into pflgsall array
           endpflg,         // scrolled ending pos into pflgsall array
-          begtask,         // scrolled beginning pos into Frame_maxtask
+          begtask,         // scrolled beginning pos into total tasks
 #ifndef SCROLLVAR_NO
           varcolbeg,       // scrolled position within variable width col
 #endif
@@ -406,44 +405,6 @@ typedef struct WIN_t {
         /* Used to clear all or part of our Pseudo_screen */
 #define PSU_CLREOS(y) memset(&Pseudo_screen[ROWMAXSIZ*y], '\0', Pseudo_size-(ROWMAXSIZ*y))
 
-        /* Used as return arguments in *some* of the sort callbacks */
-#define SORT_lt  ( Frame_srtflg > 0 ?  1 : -1 )
-#define SORT_gt  ( Frame_srtflg > 0 ? -1 :  1 )
-#define SORT_eq  0
-
-        /* Used to create *most* of the sort callback functions
-           note: some of the callbacks are NOT your father's callbacks, they're
-                 highly optimized to save them ol' precious cycles! */
-#define SCB_NAME(f) sort_EU_ ## f
-#define SCB_NUM1(f,n) \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      if ( (*P)->n < (*Q)->n ) return SORT_lt; \
-      if ( (*P)->n > (*Q)->n ) return SORT_gt; \
-      return SORT_eq; }
-#define SCB_NUM2(f,n1,n2) \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      if ( ((*P)->n1+(*P)->n2) < ((*Q)->n1+(*Q)->n2) ) return SORT_lt; \
-      if ( ((*P)->n1+(*P)->n2) > ((*Q)->n1+(*Q)->n2) ) return SORT_gt; \
-      return SORT_eq; }
-#define SCB_NUMx(f,n) \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      return Frame_srtflg * ( (*Q)->n - (*P)->n ); }
-#define SCB_STRS(f,s) \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      if (!(*P)->s || !(*Q)->s) return SORT_eq; \
-      return Frame_srtflg * STRCMP((*Q)->s, (*P)->s); }
-#define SCB_STRV(f,b,v,s) \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      if (b) { \
-         if (!(*P)->v || !(*Q)->v) return SORT_eq; \
-         return Frame_srtflg * STRCMP((*Q)->v[0], (*P)->v[0]); } \
-      return Frame_srtflg * STRCMP((*Q)->s, (*P)->s); }
-#define SCB_STRX(f,s) \
-   int strverscmp(const char *s1, const char *s2); \
-   static int SCB_NAME(f) (const proc_t **P, const proc_t **Q) { \
-      if (!(*P)->s || !(*Q)->s) return SORT_eq; \
-      return Frame_srtflg * strverscmp((*Q)->s, (*P)->s); }
-
 /*
  * The following three macros are used to 'inline' those portions of the
  * display process involved in formatting, while protecting against any