Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The calloc() takes the first argument for the number of element, not the size of the element. Recent compilers warn about it like below: CC utils/graph.ot In file included from /home/namhyung/project/uftrace/utils/symbol.h:18, from /home/namhyung/project/uftrace/uftrace.h:14, from /home/namhyung/project/uftrace/utils/graph.h:7, from /home/namhyung/project/uftrace/utils/graph.c:1: /home/namhyung/project/uftrace/utils/graph.c: In function ‘setup_fstack_and_graph’: /home/namhyung/project/uftrace/utils/graph.c:300:41: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 300 | task.func_stack = xcalloc(sizeof(*task.func_stack), len); | ^ /home/namhyung/project/uftrace/utils/utils.h:202:38: note: in definition of macro ‘xcalloc’ 202 | void *__ptr = calloc(n, sz); \ | ^ /home/namhyung/project/uftrace/utils/graph.c:300:41: note: earlier argument should specify number of elements, later size of each element 300 | task.func_stack = xcalloc(sizeof(*task.func_stack), len); | ^ /home/namhyung/project/uftrace/utils/utils.h:202:38: note: in definition of macro ‘xcalloc’ 202 | void *__ptr = calloc(n, sz); \ | ^ Signed-off-by: Namhyung Kim <namhyung@gmail.com>
- Loading branch information