log: initialize pos to help the compiler

Although pos will be set to 0 in the first iteration, the compiler does
not seem to figure this out, so help it a little:

../spa/include/spa/support/log.h:306:21: warning: ‘pos’ may be used uninitialized [-Wmaybe-uninitialized]
  306 |                 pos += sprintf(str + pos, "%02x ", buf[i]);                             \
      |                     ^~
../spa/include/spa/support/log.h:301:13: note: ‘pos’ was declared here
  301 |         int pos;                                                                        \
      |             ^~~
This commit is contained in:
Wim Taymans 2022-09-07 09:17:19 +02:00
parent 2c72597271
commit 968bc382af

View file

@ -298,7 +298,7 @@ do { \
char str[512]; \
uint8_t *buf = (uint8_t *)data; \
size_t i; \
int pos; \
int pos = 0; \
\
for (i = 0; i < len; i++) { \
if (i % 16 == 0) \