From 215a54f729df052fd1753ecbbad59958a75d3c81 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 1 Dec 2015 00:00:00 -0500 Subject: [PATCH] top: eliminate all superfluous cruft under the new API 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 --- top/top.c | 3 +-- top/top.h | 41 +---------------------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/top/top.c b/top/top.c index 22a151c2..d0ce0ecd 100644 --- 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; } diff --git a/top/top.h b/top/top.h index b9dda6e2..22a14ee5 100644 --- a/top/top.h +++ b/top/top.h @@ -22,7 +22,6 @@ #include #include -#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