Recent gcc versions think the code used in SREALLOC() macro might be
wrong because we use the result of a multiplication as a boolean value:
In file included from sa.h:11,
from sadc.c:37:
sadc.c: In function ‘sa_sys_init’:
sadc.c:336:55: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
(size_t) act[i]->msize * (size_t) act[i]->nr_ini * (size_t) act[i]->nr2);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
common.h:125:16: note: in definition of macro ‘SREALLOC’
if (SIZE) { \
^~~~
Add a comparison to zero to make clear to gcc that the code is actually
fine.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
/* Allocate and init structure */
#define SREALLOC(S, TYPE, SIZE) do { \
TYPE *_p_ = S; \
- if (SIZE) { \
+ if ((SIZE) != 0) { \
if ((S = (TYPE *) realloc(S, (SIZE))) == NULL) { \
perror("realloc"); \
exit(4); \