Fix: avoid -Wmaybe-uninitialized warning in validate_map_value_entry
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 11 Oct 2019 19:12:33 +0000 (15:12 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 11 Oct 2019 19:52:43 +0000 (15:52 -0400)
We get this warning when building with gcc at -Og:

    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c: In function ‘validate_map_value_entry’:
    /home/smarchi/src/babeltrace/src/plugins/common/param-validation/param-validation.c:182:18: error: ‘candidate’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       data->status = validate_value(value, &candidate->value_descr,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        data->ctx);
        ~~~~~~~~~~

Even though the code looks safe, we can modify it a little bit to avoid
that warning, and maybe even be a bit more readable.

Change-Id: I7a87d8125732744c4ff45fc0c0863c6dc9c26173
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2176
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>

No differences found
This page took 0.024923 seconds and 4 git commands to generate.