count: fix types in sorting comparison callbacks

* count.c (time_cmp. syscall_cmp): Change arguments type
to "const void *", Change indices cast type to "unsigned int *".
(count cmp): Likewise. Change count variables type to unsigned int.
(sortfun): Provide types of arguments.
This commit is contained in:
Eugene Syromyatnikov 2018-09-02 23:05:27 +02:00
parent d58f4c7ee8
commit 8b2355f55f

20
count.c
View File

@ -79,30 +79,30 @@ count_syscall(struct tcb *tcp, const struct timespec *syscall_exiting_ts)
}
static int
time_cmp(void *a, void *b)
time_cmp(const void *a, const void *b)
{
return -ts_cmp(&counts[*((int *) a)].time,
&counts[*((int *) b)].time);
return -ts_cmp(&counts[*((unsigned int *) a)].time,
&counts[*((unsigned int *) b)].time);
}
static int
syscall_cmp(void *a, void *b)
syscall_cmp(const void *a, const void *b)
{
const char *a_name = sysent[*((int *) a)].sys_name;
const char *b_name = sysent[*((int *) b)].sys_name;
const char *a_name = sysent[*((unsigned int *) a)].sys_name;
const char *b_name = sysent[*((unsigned int *) b)].sys_name;
return strcmp(a_name ? a_name : "", b_name ? b_name : "");
}
static int
count_cmp(void *a, void *b)
count_cmp(const void *a, const void *b)
{
int m = counts[*((int *) a)].calls;
int n = counts[*((int *) b)].calls;
unsigned int m = counts[*((unsigned int *) a)].errors;
unsigned int n = counts[*((unsigned int *) b)].errors;
return (m < n) ? 1 : (m > n) ? -1 : 0;
}
static int (*sortfun)();
static int (*sortfun)(const void *a, const void *b);
void
set_sortby(const char *sortby)