ACK: [PATCH 6/7] lib: fwts_framework: initialize msg to literal string

ivanhu ivan.hu at canonical.com
Mon Oct 24 08:04:00 UTC 2016


On 2016年10月19日 21:26, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Rather than assigning msg to NULL and then to a literal string instead
> just assign it to the literal string. Also make it a static const.
>
> Cleans up cppcheck style warning:
> src/lib/src/fwts_framework.c:616: (style) Variable 'msg' is reassigned a
>   value before the old one has been use
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_framework.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index 992d901..201afea 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -607,13 +607,13 @@ static int fwts_framework_run_test(fwts_framework *fw, fwts_framework_test *test
>
>  	if (!fwts_firmware_has_features(test->fw_features)) {
>  		int missing = test->fw_features & ~fwts_firmware_features();
> -		char *msg = NULL;
> +		static const char *msg = "Test skipped, missing features";
> +
>  		fwts_log_info(fw, "Test skipped, missing features: %s",
>  			fwts_firmware_feature_string(missing));
>  		fw->current_major_test->results.skipped +=
>  			test->ops->total_tests;
>  		fw->total.skipped += test->ops->total_tests;
> -		msg = "Test skipped, missing features";
>  		if (fw->show_progress) {
>  			fwts_framework_minor_test_progress_clear_line();
>  			fprintf(stderr, "  %s: %s\n",
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list