top: use the type size_t more consistently for inspect
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
705d1b28cd
commit
d2c84c6e13
14
top/top.c
14
top/top.c
@ -1066,7 +1066,7 @@ static char *linein (const char *prompt) {
|
|||||||
*
|
*
|
||||||
* He always creates a buffer at least READMINSZ big, possibly
|
* He always creates a buffer at least READMINSZ big, possibly
|
||||||
* all zeros (an empty string), even if the file wasn't read. */
|
* all zeros (an empty string), even if the file wasn't read. */
|
||||||
static int readfile (FILE *fp, char **baddr, unsigned *bsize, unsigned *bread) {
|
static int readfile (FILE *fp, char **baddr, size_t *bsize, size_t *bread) {
|
||||||
char chunk[4096*16];
|
char chunk[4096*16];
|
||||||
size_t num;
|
size_t num;
|
||||||
|
|
||||||
@ -2354,8 +2354,8 @@ static void sysinfo_refresh (int forced) {
|
|||||||
static char **Insp_p; // pointers to each line start
|
static char **Insp_p; // pointers to each line start
|
||||||
static int Insp_nl; // total lines, total Insp_p entries
|
static int Insp_nl; // total lines, total Insp_p entries
|
||||||
static char *Insp_buf; // the results from insp_do_file/pipe
|
static char *Insp_buf; // the results from insp_do_file/pipe
|
||||||
static unsigned Insp_bufsz; // allocated size of Insp_buf
|
static size_t Insp_bufsz; // allocated size of Insp_buf
|
||||||
static unsigned Insp_bufrd; // bytes actually in Insp_buf
|
static size_t Insp_bufrd; // bytes actually in Insp_buf
|
||||||
static char *Insp_selname; // the selected label, if anybody cares
|
static char *Insp_selname; // the selected label, if anybody cares
|
||||||
static char *Insp_selfmts; // the selected path/command, ditto
|
static char *Insp_selfmts; // the selected path/command, ditto
|
||||||
|
|
||||||
@ -2368,7 +2368,7 @@ static char *Insp_selfmts; // the selected path/command, ditto
|
|||||||
putp(Caps_off); }
|
putp(Caps_off); }
|
||||||
|
|
||||||
// Our 'row length' macro, equivalent to a strlen() call
|
// Our 'row length' macro, equivalent to a strlen() call
|
||||||
#define INSP_RLEN(idx) (size_t)(Insp_p[idx +1] - Insp_p[idx] -1)
|
#define INSP_RLEN(idx) (int)(Insp_p[idx +1] - Insp_p[idx] -1)
|
||||||
|
|
||||||
// Our 'busy' (wait please) macro
|
// Our 'busy' (wait please) macro
|
||||||
#define INSP_BUSY { INSP_MKSL(0, N_txt(YINSP_workin_txt)); \
|
#define INSP_BUSY { INSP_MKSL(0, N_txt(YINSP_workin_txt)); \
|
||||||
@ -2423,7 +2423,7 @@ static void insp_cnt_nl (void) {
|
|||||||
static void insp_do_demo (char *fmts, int pid) {
|
static void insp_do_demo (char *fmts, int pid) {
|
||||||
(void)fmts; (void)pid;
|
(void)fmts; (void)pid;
|
||||||
Insp_bufsz = READMINSZ;
|
Insp_bufsz = READMINSZ;
|
||||||
Insp_buf = alloc_c(Insp_bufsz);
|
Insp_buf = alloc_c(READMINSZ);
|
||||||
Insp_bufrd = snprintf(Insp_buf, Insp_bufsz, "%s", N_txt(YINSP_demo04_txt));
|
Insp_bufrd = snprintf(Insp_buf, Insp_bufsz, "%s", N_txt(YINSP_demo04_txt));
|
||||||
insp_cnt_nl();
|
insp_cnt_nl();
|
||||||
} // end: insp_do_demo
|
} // end: insp_do_demo
|
||||||
@ -2541,12 +2541,12 @@ static inline void insp_show_pg (int col, int row, int max) {
|
|||||||
, Insp_selname
|
, Insp_selname
|
||||||
, r, l, r, ls
|
, r, l, r, ls
|
||||||
, c, col + 1, c, col + Screen_cols
|
, c, col + 1, c, col + Screen_cols
|
||||||
, Insp_bufrd);
|
, (unsigned long)Insp_bufrd);
|
||||||
INSP_MKSL(0, buf);
|
INSP_MKSL(0, buf);
|
||||||
|
|
||||||
for ( ; max && row < Insp_nl; row++) {
|
for ( ; max && row < Insp_nl; row++) {
|
||||||
char tline[SCREENMAX];
|
char tline[SCREENMAX];
|
||||||
size_t fr, to, len;
|
int fr, to, len;
|
||||||
|
|
||||||
capNO;
|
capNO;
|
||||||
putp("\n");
|
putp("\n");
|
||||||
|
@ -609,7 +609,7 @@ typedef struct WIN_t {
|
|||||||
//atic int chin (int ech, char *buf, unsigned cnt);
|
//atic int chin (int ech, char *buf, unsigned cnt);
|
||||||
//atic int keyin (int init);
|
//atic int keyin (int init);
|
||||||
//atic char *linein (const char *prompt);
|
//atic char *linein (const char *prompt);
|
||||||
//atic int readfile (FILE *fp, char **baddr, unsigned *bsize, unsigned *bread);
|
//atic int readfile (FILE *fp, char **baddr, size_t *bsize, size_t *bread);
|
||||||
/*------ Small Utility routines ----------------------------------------*/
|
/*------ Small Utility routines ----------------------------------------*/
|
||||||
//atic float get_float (const char *prompt);
|
//atic float get_float (const char *prompt);
|
||||||
//atic int get_int (const char *prompt);
|
//atic int get_int (const char *prompt);
|
||||||
|
@ -418,7 +418,7 @@ static void build_norm_nlstab (void) {
|
|||||||
Norm_nlstab[YINSP_pidbad_fmt] = _("unable to inspect, pid %d not found");
|
Norm_nlstab[YINSP_pidbad_fmt] = _("unable to inspect, pid %d not found");
|
||||||
Norm_nlstab[YINSP_pidsee_fmt] = _("inspect at PID [defailt pid = %d]");
|
Norm_nlstab[YINSP_pidsee_fmt] = _("inspect at PID [defailt pid = %d]");
|
||||||
Norm_nlstab[YINSP_rcfile_fmt] = _("could not parse rcfile inspect entry %d");
|
Norm_nlstab[YINSP_rcfile_fmt] = _("could not parse rcfile inspect entry %d");
|
||||||
Norm_nlstab[YINSP_status_fmt] = _("%s: %*d-%-*d lines, %*d-%*d columns, %u bytes read");
|
Norm_nlstab[YINSP_status_fmt] = _("%s: %*d-%-*d lines, %*d-%*d columns, %lu bytes read");
|
||||||
Norm_nlstab[YINSP_workin_txt] = _("patience please, working...");
|
Norm_nlstab[YINSP_workin_txt] = _("patience please, working...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user