count.c: cleanup types and sizeof usage

* count.c (call_summary_pers): Change the type of sorted_count
to "unsigned int *".  Replace sizeof(int) with  sizeof(sorted_count[0]).
Change the type of idx to unsigned int.
This commit is contained in:
Eugene Syromyatnikov 2018-01-05 04:06:58 +01:00 committed by Dmitry V. Levin
parent e7362ec6dc
commit 48b96efc22

View File

@ -164,14 +164,14 @@ call_summary_pers(FILE *outf)
struct timeval tv_cum, dtv;
double float_tv_cum;
double percent;
int *sorted_count;
unsigned int *sorted_count;
fprintf(outf, header,
"% time", "seconds", "usecs/call",
"calls", "errors", "syscall");
fprintf(outf, header, dashes, dashes, dashes, dashes, dashes, dashes);
sorted_count = xcalloc(sizeof(int), nsyscalls);
sorted_count = xcalloc(sizeof(sorted_count[0]), nsyscalls);
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
if (overhead.tv_sec == -1) {
tv_mul(&overhead, &shortest, 8);
@ -190,10 +190,11 @@ call_summary_pers(FILE *outf)
float_tv_cum = tv_float(&tv_cum);
if (counts) {
if (sortfun)
qsort((void *) sorted_count, nsyscalls, sizeof(int), sortfun);
qsort((void *) sorted_count, nsyscalls,
sizeof(sorted_count[0]), sortfun);
for (i = 0; i < nsyscalls; i++) {
double float_syscall_time;
int idx = sorted_count[i];
unsigned int idx = sorted_count[i];
struct call_counts *cc = &counts[idx];
if (cc->calls == 0)
continue;