reallocarray: eliminate compilation warnings (#3798)
authorRong Tao <32674962+Rtoax@users.noreply.github.com>
Sat, 8 Jan 2022 19:36:00 +0000 (03:36 +0800)
committerGitHub <noreply@github.com>
Sat, 8 Jan 2022 19:36:00 +0000 (11:36 -0800)
commit96aaf1598a9907b4e67d9f45637985662099f899
treed9080de25ec8fc43ff3921d531b2e3ae61356093
parenteab81d91290a6987f87f34366a963e2d6a7fcb40
reallocarray: eliminate compilation warnings (#3798)

there are compile warnings below for klockstat.

```bash
  CC       klockstat.o
klockstat.c: In function ‘print_stats’:
klockstat.c:396:12: warning: implicit declaration of function ‘reallocarray’; did you mean ‘realloc’? [-Wimplicit-function-declaration]
    stats = reallocarray(stats, stats_sz, sizeof(void *));
            ^~~~~~~~~~~~
            realloc
klockstat.c:396:10: warning: assignment to ‘struct stack_stat **’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    stats = reallocarray(stats, stats_sz, sizeof(void *));
          ^
  BINARY   klockstat
```

Defining _GNU_SOURCE fixed the problem.
libbpf-tools/klockstat.c