From f1089572ca6ab9daa623a17af78bd4947850e38a Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 9 Aug 2019 09:44:51 -0400 Subject: [PATCH] Fix: muxer.c: compare_events(): initialize `ret` to 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit GCC complains when this `ret` is not initialized: muxer.c: In function ‘compare_events’: muxer.c:993:9: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] return ret; It reaches `return ret` with an uninitialized `ret` when all the tests fail to find a difference (which can happen). Signed-off-by: Philippe Proulx Change-Id: Ib0541150173dbc845ba5784abfc5e131412d2663 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1846 Tested-by: jenkins --- src/plugins/utils/muxer/muxer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/utils/muxer/muxer.c b/src/plugins/utils/muxer/muxer.c index f92f8326..cc0d8cb4 100644 --- a/src/plugins/utils/muxer/muxer.c +++ b/src/plugins/utils/muxer/muxer.c @@ -916,7 +916,7 @@ int compare_messages_by_type(struct messages_to_compare *msgs) static int compare_events(const bt_event *left_event, const bt_event *right_event) { - int ret; + int ret = 0; const bt_event_class *left_event_class, *right_event_class; uint64_t left_event_class_id, right_event_class_id; const char *left_event_class_name, *right_event_class_name, -- 2.34.1