ACK: [PATCH] kernelscan: fix variable shadowing warning
ivanhu
ivan.hu at canonical.com
Mon Jan 18 07:01:07 UTC 2021
On 1/14/21 11:13 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Cppcheck is warning about variable name shadowing. Fix this by
> renaming the top level variable 'patterns' to 'klog_patterns'.
>
> Cleans up cppcheck warning:
> src/utilities/kernelscan.c:352:16: style: Local variable 'patterns'
> shadows outer variable [shadowVariable]
> klog_pattern *patterns;
>
> src/utilities/kernelscan.c:113:22: note: Shadowed declaration
> static klog_pattern *patterns;
>
> src/utilities/kernelscan.c:352:16: note: Shadow variable
> klog_pattern *patterns;
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/utilities/kernelscan.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/utilities/kernelscan.c b/src/utilities/kernelscan.c
> index 96e6ca4f..033e2176 100644
> --- a/src/utilities/kernelscan.c
> +++ b/src/utilities/kernelscan.c
> @@ -110,7 +110,7 @@ typedef struct {
> /*
> * FWTS klog patterns, loaded from a json file
> */
> -static klog_pattern *patterns;
> +static klog_pattern *klog_patterns;
>
> static unsigned int hash_size;
>
> @@ -936,7 +936,7 @@ static int parse_kernel_message(parser *p, token *t)
> got_string = false;
>
> if (str) {
> - found |= klog_find(str, patterns);
> + found |= klog_find(str, klog_patterns);
> free(str);
> str = NULL;
> }
> @@ -1057,10 +1057,10 @@ int main(int argc, char **argv)
> }
> }
>
> - patterns = klog_load("firmware_error_warning_patterns");
> + klog_patterns = klog_load("firmware_error_warning_patterns");
> hash_init();
> parse_kernel_messages(stdin);
> - klog_free(patterns);
> + klog_free(klog_patterns);
>
> exit(EXIT_SUCCESS);
> }
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list