Message ID | 20181024040354.24879-5-leobras.c@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Adds -Wshadow on KBUILD_HOSTCFLAGS and fix warnings | expand |
On Wed, Oct 24, 2018 at 1:05 PM Leonardo Bras <leobras.c@gmail.com> wrote: > > Changes the parameter name to avoid shadowing a variable. > > Signed-off-by: Leonardo Bras <leobras.c@gmail.com> For this one, I'd rather like to see code refactoring than renaming the variable. I will take a closer look. > --- > scripts/mod/modpost.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > index 0d998c54564d..368fe42340df 100644 > --- a/scripts/mod/modpost.c > +++ b/scripts/mod/modpost.c > @@ -2228,13 +2228,13 @@ static int add_versions(struct buffer *b, struct module *mod) > } > > static void add_depends(struct buffer *b, struct module *mod, > - struct module *modules) > + struct module *module_list) > { > struct symbol *s; > struct module *m; > int first = 1; > > - for (m = modules; m; m = m->next) > + for (m = module_list; m; m = m->next) > m->seen = is_vmlinux(m->name); > > buf_printf(b, "\n"); > -- > 2.19.1 >
Em seg, 2018-10-29 às 01:42 +0900, Masahiro Yamada escreveu: > On Wed, Oct 24, 2018 at 1:05 PM Leonardo Bras <leobras.c@gmail.com> > wrote: > > Changes the parameter name to avoid shadowing a variable. > > > > Signed-off-by: Leonardo Bras <leobras.c@gmail.com> > > For this one, I'd rather like to see code refactoring > than renaming the variable. > > I will take a closer look. What do you suggest to refactor? I volunteer for this work. Leonardo Bras
Em qua, 2018-10-31 às 20:24 -0300, Leonardo Bras escreveu: > Em seg, 2018-10-29 às 01:42 +0900, Masahiro Yamada escreveu: > > On Wed, Oct 24, 2018 at 1:05 PM Leonardo Bras <leobras.c@gmail.com> > > wrote: > > > Changes the parameter name to avoid shadowing a variable. > > > > > > Signed-off-by: Leonardo Bras <leobras.c@gmail.com> > > > > For this one, I'd rather like to see code refactoring > > than renaming the variable. > > > > I will take a closer look. > > What do you suggest to refactor? > I volunteer for this work. > > Leonardo Bras > I refactored the code to move the global variable *modules to a local context at function main, and changed the functions to accept *modules as a parameter. Is that what you had in mind? https://lkml.org/lkml/2018/11/1/725 Thanks for reading, Leonardo Bras
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 0d998c54564d..368fe42340df 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2228,13 +2228,13 @@ static int add_versions(struct buffer *b, struct module *mod) } static void add_depends(struct buffer *b, struct module *mod, - struct module *modules) + struct module *module_list) { struct symbol *s; struct module *m; int first = 1; - for (m = modules; m; m = m->next) + for (m = module_list; m; m = m->next) m->seen = is_vmlinux(m->name); buf_printf(b, "\n");
Changes the parameter name to avoid shadowing a variable. Signed-off-by: Leonardo Bras <leobras.c@gmail.com> --- scripts/mod/modpost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)