From 48b96efc220f2110cad62f9915888b858337117e Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Fri, 5 Jan 2018 04:06:58 +0100 Subject: [PATCH] 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. --- count.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/count.c b/count.c index 7bcedf96..a374bad0 100644 --- a/count.c +++ b/count.c @@ -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; -- 2.40.0