WARNS fixes: mainly constness and avoid comparing signed with

unsigned by making array indicies unsigned. Also note one or two
unused parameters.
This commit is contained in:
David Malone 2008-02-08 11:03:05 +00:00
parent 84eebcc257
commit 97ce0ae60f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176107
6 changed files with 19 additions and 14 deletions

View File

@ -81,12 +81,12 @@ kinfo_proc_compare(const void *a, const void *b)
{
int i;
i = ((struct kinfo_proc *)a)->ki_pid -
((struct kinfo_proc *)b)->ki_pid;
i = ((const struct kinfo_proc *)a)->ki_pid -
((const struct kinfo_proc *)b)->ki_pid;
if (i != 0)
return (i);
i = ((struct kinfo_proc *)a)->ki_tid -
((struct kinfo_proc *)b)->ki_tid;
i = ((const struct kinfo_proc *)a)->ki_tid -
((const struct kinfo_proc *)b)->ki_tid;
return (i);
}
@ -100,7 +100,8 @@ kinfo_proc_sort(struct kinfo_proc *kipp, int count)
int
main(int argc, char *argv[])
{
int ch, i, interval, name[4], tmp;
int ch, interval, name[4], tmp;
unsigned int i;
struct kinfo_proc *kipp;
size_t len;
long l;
@ -208,7 +209,7 @@ main(int argc, char *argv[])
}
free(kipp);
}
for (i = 0; i < argc; i++) {
for (i = 0; i < (unsigned int)argc; i++) {
l = strtol(argv[i], &dummy, 10);
if (*dummy != '\0')
usage();

View File

@ -37,7 +37,7 @@
#include "procstat.h"
void
procstat_basic(pid_t pid, struct kinfo_proc *kipp)
procstat_basic(pid_t pid __unused, struct kinfo_proc *kipp)
{
if (!hflag)

View File

@ -134,7 +134,8 @@ void
procstat_files(pid_t pid, struct kinfo_proc *kipp)
{
struct kinfo_file *freep, *kif;
int error, i, name[4];
int error, name[4];
unsigned int i;
const char *str;
size_t len;

View File

@ -111,8 +111,8 @@ static int
kinfo_kstack_compare(const void *a, const void *b)
{
return ((struct kinfo_kstack *)a)->kkst_tid -
((struct kinfo_kstack *)b)->kkst_tid;
return ((const struct kinfo_kstack *)a)->kkst_tid -
((const struct kinfo_kstack *)b)->kkst_tid;
}
static void
@ -129,7 +129,8 @@ procstat_kstack(pid_t pid, struct kinfo_proc *kipp, int kflag)
struct kinfo_kstack *kkstp, *kkstp_free;
struct kinfo_proc *kip, *kip_free;
char trace[KKST_MAXLEN];
int error, i, j, name[4];
int error, name[4];
unsigned int i, j;
size_t kip_len, kstk_len;
if (!hflag)

View File

@ -42,7 +42,8 @@ void
procstat_threads(pid_t pid, struct kinfo_proc *kipp)
{
struct kinfo_proc *kip;
int error, i, name[4];
int error, name[4];
unsigned int i;
const char *str;
size_t len;

View File

@ -38,10 +38,11 @@
#include "procstat.h"
void
procstat_vm(pid_t pid, struct kinfo_proc *kipp)
procstat_vm(pid_t pid, struct kinfo_proc *kipp __unused)
{
struct kinfo_vmentry *freep, *kve;
int error, i, name[4], ptrwidth;
int error, name[4], ptrwidth;
unsigned int i;
const char *str;
size_t len;