Fix: muxer.c: compare_events(): initialize `ret` to 0
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 9 Aug 2019 13:44:51 +0000 (09:44 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 9 Aug 2019 14:21:24 +0000 (10:21 -0400)
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 <eeppeliteloop@gmail.com>
Change-Id: Ib0541150173dbc845ba5784abfc5e131412d2663
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1846
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/utils/muxer/muxer.c

index f92f8326b14c8bfc9c5254940358371ef665bb6c..cc0d8cb4789ccf36460596d04a1b5e252aa9494b 100644 (file)
@@ -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,
This page took 0.02545 seconds and 4 git commands to generate.