You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2018/12/05 16:42:20 UTC

[mynewt-core] 02/02: sys/log: Fix spurious uninitialized variable varning

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 5826438d7c187a5e041a49eca76e40cc092c9461
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Dec 5 17:20:22 2018 +0100

    sys/log: Fix spurious uninitialized variable varning
    
    GCC 7.3.1 complains about possible uinitialized 'rc' variable in
    'shell_log_dump_entry' at 'if (rc < len) {` in optimized build.
    
    This does not seem to be correct, but let's make it happy and
    initialize 'rc'.
---
 sys/log/full/src/log_shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/log/full/src/log_shell.c b/sys/log/full/src/log_shell.c
index 0252552..b47e82f 100644
--- a/sys/log/full/src/log_shell.c
+++ b/sys/log/full/src/log_shell.c
@@ -152,7 +152,7 @@ shell_log_dump_entry(struct log *log, struct log_offset *log_offset,
 {
     char data[128 + 1];
     int dlen;
-    int rc;
+    int rc = 0;
 #if MYNEWT_VAL(LOG_VERSION) > 2
     struct CborParser cbor_parser;
     struct CborValue cbor_value;