top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces the number of warnings at WARNS=6 - use "static" where possible - sprinkle const where possible This leaves at WARNS=6: 35 warnings in top.c 88 warnings in machine.c 7 warnings in commands.c all of which are either "incompatible-pointer-types-discards-qualifiers" or "cast-qual"
This commit is contained in:
parent
d5ffad074b
commit
23c360e23f
@ -588,13 +588,10 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
|
||||
* for i_memory ONLY: cursor is on the previous line
|
||||
*/
|
||||
|
||||
char memory_buffer[MAX_COLS];
|
||||
static char memory_buffer[MAX_COLS];
|
||||
|
||||
void
|
||||
i_memory(stats)
|
||||
|
||||
int *stats;
|
||||
|
||||
i_memory(int *stats)
|
||||
{
|
||||
fputs("\nMem: ", stdout);
|
||||
lastline++;
|
||||
@ -605,10 +602,7 @@ int *stats;
|
||||
}
|
||||
|
||||
void
|
||||
u_memory(stats)
|
||||
|
||||
int *stats;
|
||||
|
||||
u_memory(int *stats)
|
||||
{
|
||||
static char new[MAX_COLS];
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
#define SMPUNAMELEN 13
|
||||
#define UPUNAMELEN 15
|
||||
|
||||
extern struct process_select ps;
|
||||
extern struct timeval timeout;
|
||||
static int smpmode;
|
||||
enum displaymodes displaymode;
|
||||
@ -743,7 +742,7 @@ get_io_total(struct kinfo_proc *pp)
|
||||
|
||||
static struct handle handle;
|
||||
|
||||
caddr_t
|
||||
void *
|
||||
get_process_info(struct system_info *si, struct process_select *sel,
|
||||
int (*compare)(const void *, const void *))
|
||||
{
|
||||
|
@ -84,8 +84,9 @@ int proc_owner(int pid);
|
||||
|
||||
/* non-int routines typically used by the machine dependent module */
|
||||
char *printable(char *string);
|
||||
extern struct process_select ps;
|
||||
|
||||
caddr_t
|
||||
void *
|
||||
get_process_info(struct system_info *si, struct process_select *sel,
|
||||
int (*compare)(const void *, const void *));
|
||||
|
||||
|
@ -39,18 +39,18 @@ char ch_erase;
|
||||
char ch_kill;
|
||||
char smart_terminal;
|
||||
char PC;
|
||||
char termcap_buf[1024];
|
||||
char string_buffer[1024];
|
||||
char home[15];
|
||||
char lower_left[15];
|
||||
static char termcap_buf[1024];
|
||||
static char string_buffer[1024];
|
||||
static char home[15];
|
||||
static char lower_left[15];
|
||||
char *clear_line;
|
||||
char *clear_screen;
|
||||
static char *clear_screen;
|
||||
char *clear_to_end;
|
||||
char *cursor_motion;
|
||||
char *start_standout;
|
||||
char *end_standout;
|
||||
char *terminal_init;
|
||||
char *terminal_end;
|
||||
static char *start_standout;
|
||||
static char *end_standout;
|
||||
static char *terminal_init;
|
||||
static char *terminal_end;
|
||||
|
||||
static struct termios old_settings;
|
||||
static struct termios new_settings;
|
||||
|
@ -40,7 +40,7 @@
|
||||
/* Size of the stdio buffer given to stdout */
|
||||
#define Buffersize 2048
|
||||
|
||||
char *copyright =
|
||||
char copyright[] =
|
||||
"Copyright (c) 1984 through 1996, William LeFebvre";
|
||||
|
||||
typedef void sigret_t;
|
||||
@ -211,7 +211,7 @@ char *argv[];
|
||||
|
||||
struct system_info system_info;
|
||||
struct statics statics;
|
||||
caddr_t processes;
|
||||
void * processes;
|
||||
|
||||
static char tempbuf1[50];
|
||||
static char tempbuf2[50];
|
||||
|
@ -53,7 +53,7 @@ extern int (*compares[])(const void*, const void*);
|
||||
char* kill_procs(char *);
|
||||
char* renice_procs(char *);
|
||||
|
||||
extern char *copyright;
|
||||
extern char copyright[];
|
||||
/* internal routines */
|
||||
void quit(int);
|
||||
|
||||
|
@ -56,7 +56,7 @@ struct hash_el {
|
||||
|
||||
/* K&R requires that statically declared tables be initialized to zero. */
|
||||
/* We depend on that for hash_table and YOUR compiler had BETTER do it! */
|
||||
struct hash_el hash_table[Table_size];
|
||||
static struct hash_el hash_table[Table_size];
|
||||
|
||||
|
||||
char *username(uid)
|
||||
|
Loading…
Reference in New Issue
Block a user