Message ID | 60e2908f5a6c8aec082b59b44a688c260805c7b2.1690208527.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [XEN,v2] efi: mechanical renaming to address MISRA C:2012 Rule 5.3 | expand |
On 24.07.2023 16:26, Nicola Vetrini wrote: > Rule 5.3 has the following headline: > "An identifier declared in an inner scope shall not hide an > identifier declared in an outer scope" > > The function parameters renamed in this patch are hiding a variable defined > in an enclosing scope. > > The following rename is made: > - s/cfg/file/ > to distinguish from the variable 'cfg', which is hidden by the parameter inside > the modified functions. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Somewhat hesitantly Acked-by: Jan Beulich <jbeulich@suse.com> Jan
On Mon, 24 Jul 2023, Nicola Vetrini wrote: > Rule 5.3 has the following headline: > "An identifier declared in an inner scope shall not hide an > identifier declared in an outer scope" > > The function parameters renamed in this patch are hiding a variable defined > in an enclosing scope. > > The following rename is made: > - s/cfg/file/ > to distinguish from the variable 'cfg', which is hidden by the parameter inside > the modified functions. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/common/efi/boot.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c > index 24169b7b50..79a654af69 100644 > --- a/xen/common/efi/boot.c > +++ b/xen/common/efi/boot.c > @@ -528,10 +528,10 @@ static char * __init split_string(char *s) > return NULL; > } > > -static char *__init get_value(const struct file *cfg, const char *section, > +static char *__init get_value(const struct file *file, const char *section, > const char *item) > { > - char *ptr = cfg->str, *end = ptr + cfg->size; > + char *ptr = file->str, *end = ptr + file->size; > size_t slen = section ? strlen(section) : 0, ilen = strlen(item); > bool match = !slen; > > @@ -821,9 +821,9 @@ static bool __init read_section(const EFI_LOADED_IMAGE *image, > return true; > } > > -static void __init pre_parse(const struct file *cfg) > +static void __init pre_parse(const struct file *file) > { > - char *ptr = cfg->str, *end = ptr + cfg->size; > + char *ptr = file->str, *end = ptr + file->size; > bool start = true, comment = false; > > for ( ; ptr < end; ++ptr ) > @@ -844,7 +844,7 @@ static void __init pre_parse(const struct file *cfg) > else > start = 0; > } > - if ( cfg->size && end[-1] ) > + if ( file->size && end[-1] ) > PrintStr(L"No newline at end of config file," > " last line will be ignored.\r\n"); > } > -- > 2.34.1 >
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 24169b7b50..79a654af69 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -528,10 +528,10 @@ static char * __init split_string(char *s) return NULL; } -static char *__init get_value(const struct file *cfg, const char *section, +static char *__init get_value(const struct file *file, const char *section, const char *item) { - char *ptr = cfg->str, *end = ptr + cfg->size; + char *ptr = file->str, *end = ptr + file->size; size_t slen = section ? strlen(section) : 0, ilen = strlen(item); bool match = !slen; @@ -821,9 +821,9 @@ static bool __init read_section(const EFI_LOADED_IMAGE *image, return true; } -static void __init pre_parse(const struct file *cfg) +static void __init pre_parse(const struct file *file) { - char *ptr = cfg->str, *end = ptr + cfg->size; + char *ptr = file->str, *end = ptr + file->size; bool start = true, comment = false; for ( ; ptr < end; ++ptr ) @@ -844,7 +844,7 @@ static void __init pre_parse(const struct file *cfg) else start = 0; } - if ( cfg->size && end[-1] ) + if ( file->size && end[-1] ) PrintStr(L"No newline at end of config file," " last line will be ignored.\r\n"); }
Rule 5.3 has the following headline: "An identifier declared in an inner scope shall not hide an identifier declared in an outer scope" The function parameters renamed in this patch are hiding a variable defined in an enclosing scope. The following rename is made: - s/cfg/file/ to distinguish from the variable 'cfg', which is hidden by the parameter inside the modified functions. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> --- xen/common/efi/boot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)