top: let's eliminate some additional compiler warnings
This patch eliminates those warnings referenced below. They are sometimes associated with an obscure #define. We'll also corrrect one header file function prototype so it will aggree with the actual function definition. Reference(s): top.c: In function 'adj_geometry': top.c:1874:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 1874 | if (Screen_cols < DOUBLE_limit) Curwin->rc.double_up = 0; | ^ top.c: In function 'zap_fieldstab': top.c:2359:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 2359 | if (wtab[EU_CPN].wmin < digits) { | ^ top.c:2365:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 2365 | if (wtab[EU_NMA].wmin < digits) { | ^ top.c: In function 'keys_summary': top.c:5128:45: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] 5128 | if (w->rc.double_up && Screen_cols < DOUBLE_limit) { | ^ top.c: In function 'sum_tics': top.c:5605:22: warning: unused variable 'num_syst' [-Wunused-variable] 5605 | int ix, num_user, num_syst; | ^~~~~~~~ top.c:5605:12: warning: unused variable 'num_user' [-Wunused-variable] 5605 | int ix, num_user, num_syst; | ^~~~~~~~ Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
0847ea8360
commit
2c12f1f295
25
top/top.c
25
top/top.c
@ -215,9 +215,9 @@ static char Double_sp[] = " ~1 ~6 ";
|
||||
#define DOUBLE_space (sizeof(Double_sp) - 5) // 1 for null, 4 unprintable
|
||||
#endif
|
||||
#ifdef TOG4_NOTRUNC
|
||||
#define DOUBLE_limit (160 + DOUBLE_space)
|
||||
#define DOUBLE_limit (int)( 160 + DOUBLE_space )
|
||||
#else
|
||||
#define DOUBLE_limit ( 80 )
|
||||
#define DOUBLE_limit (int)( 80 )
|
||||
#endif
|
||||
|
||||
/* Support for the new library API -- acquired (if necessary)
|
||||
@ -2307,9 +2307,8 @@ static void zap_fieldstab (void) {
|
||||
} wtab[EU_MAXPFLGS];
|
||||
#endif
|
||||
static int once;
|
||||
unsigned digits;
|
||||
int i, digits;
|
||||
char buf[8];
|
||||
int i;
|
||||
|
||||
if (!once) {
|
||||
Fieldstab[EU_CPN].width = 1;
|
||||
@ -2317,7 +2316,7 @@ static void zap_fieldstab (void) {
|
||||
Fieldstab[EU_PID].width = Fieldstab[EU_PPD].width
|
||||
= Fieldstab[EU_PGD].width = Fieldstab[EU_SID].width
|
||||
= Fieldstab[EU_TGD].width = Fieldstab[EU_TPG].width = 5;
|
||||
if (5 < (digits = procps_pid_length())) {
|
||||
if (5 < (digits = (int)procps_pid_length())) {
|
||||
if (10 < digits) error_exit(N_txt(FAIL_widepid_txt));
|
||||
Fieldstab[EU_PID].width = Fieldstab[EU_PPD].width
|
||||
= Fieldstab[EU_PGD].width = Fieldstab[EU_SID].width
|
||||
@ -2355,13 +2354,13 @@ static void zap_fieldstab (void) {
|
||||
}
|
||||
|
||||
#ifdef WIDEN_COLUMN
|
||||
digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)Cpu_cnt);
|
||||
digits = snprintf(buf, sizeof(buf), "%d", Cpu_cnt);
|
||||
if (wtab[EU_CPN].wmin < digits) {
|
||||
if (5 < digits) error_exit(N_txt(FAIL_widecpu_txt));
|
||||
wtab[EU_CPN].wmin = digits;
|
||||
Fieldstab[EU_CPN].width = maX(EU_CPN);
|
||||
}
|
||||
digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)Numa_node_tot);
|
||||
digits = snprintf(buf, sizeof(buf), "%d", Numa_node_tot);
|
||||
if (wtab[EU_NMA].wmin < digits) {
|
||||
wtab[EU_NMA].wmin = digits;
|
||||
Fieldstab[EU_NMA].width = maX(EU_NMA);
|
||||
@ -2375,12 +2374,12 @@ static void zap_fieldstab (void) {
|
||||
}
|
||||
}
|
||||
#else
|
||||
digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)Cpu_cnt);
|
||||
digits = snprintf(buf, sizeof(buf), "%d", Cpu_cnt);
|
||||
if (1 < digits) {
|
||||
if (5 < digits) error_exit(N_txt(FAIL_widecpu_txt));
|
||||
Fieldstab[EU_CPN].width = digits;
|
||||
}
|
||||
digits = (unsigned)snprintf(buf, sizeof(buf), "%u", (unsigned)Numa_node_tot);
|
||||
digits = snprintf(buf, sizeof(buf), "%d", Numa_node_tot);
|
||||
if (2 < digits)
|
||||
Fieldstab[EU_NMA].width = digits;
|
||||
|
||||
@ -5602,9 +5601,13 @@ static int sum_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
||||
{ "%-.*s~4", "%-.*s~6", Graph_blks }
|
||||
};
|
||||
SIC_t idl_frme, tot_frme;
|
||||
int ix, num_user, num_syst;
|
||||
float pct_user, pct_syst, scale;
|
||||
char user[SMLBUFSIZ], syst[SMLBUFSIZ], dual[MEDBUFSIZ];
|
||||
#ifndef QUICK_GRAPHS
|
||||
int ix, num_user, num_syst;
|
||||
#else
|
||||
int ix;
|
||||
#endif
|
||||
|
||||
idl_frme = rSv(stat_IL);
|
||||
tot_frme = rSv(stat_SUM_TOT);
|
||||
@ -5621,9 +5624,9 @@ static int sum_tics (struct stat_stack *this, const char *pfx, int nobuf) {
|
||||
, (float)rSv(stat_SI) * scale, (float)rSv(stat_ST) * scale), nobuf);
|
||||
} else {
|
||||
ix = Curwin->rc.graph_cpus - 1;
|
||||
#ifndef QUICK_GRAPHS
|
||||
pct_user = (float)rSv(stat_SUM_USR) * scale,
|
||||
pct_syst = (float)rSv(stat_SUM_SYS) * scale;
|
||||
#ifndef QUICK_GRAPHS
|
||||
num_user = (int)((pct_user * Graph_adj) + .5),
|
||||
num_syst = (int)((pct_syst * Graph_adj) + .5);
|
||||
if (num_user + num_syst > Graph_len) num_syst = Graph_len - num_user;
|
||||
|
@ -677,7 +677,7 @@ typedef struct WIN_t {
|
||||
//atic void wins_stage_2 (void);
|
||||
//atic inline int wins_usrselect (const WIN_t *q, int idx);
|
||||
/*------ Forest View support -------------------------------------------*/
|
||||
//atic void forest_adds (const int self, unsigned level);
|
||||
//atic void forest_adds (const int self, int level);
|
||||
//atic void forest_begin (WIN_t *q);
|
||||
//atic void forest_config (WIN_t *q);
|
||||
//atic inline const char *forest_display (const WIN_t *q, int idx);
|
||||
|
Loading…
Reference in New Issue
Block a user