From 968bc382afdab1c489ea400b8f8c7d6da40c7bbb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 Sep 2022 09:17:19 +0200 Subject: [PATCH] log: initialize pos to help the compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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; \ | ^~~ --- spa/include/spa/support/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spa/include/spa/support/log.h b/spa/include/spa/support/log.h index 07f390585..1475eedf2 100644 --- a/spa/include/spa/support/log.h +++ b/spa/include/spa/support/log.h @@ -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) \