Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-18 Thread Masahiro Yamada
On Thu, Oct 18, 2018 at 11:04 AM Leonardo Bras  wrote:
>
> Hello Helen,
>
> On Wed, Oct 17, 2018 at 12:06 AM Helen Koike  wrote:
> >
> > Hi Leonardo,
> >
> > On 10/16/18 9:09 PM, Leonardo Brás wrote:
> > > Removes an unnecessary shadowed local variable (start).
> > > Optimize test of isdigit:
> > > - If isalpha returns true, isdigit will return false, so no need to 
> > > test.
> >
> > This patch does two different things, it should be in two separated patches.
> Sure, no problem.
>
> >
> > >
> > > Signed-off-by: Leonardo Brás 
> > > ---
> > >  scripts/asn1_compiler.c | 7 +++
> > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> > > index c146020fc783..08bb6e5fd6ad 100644
> > > --- a/scripts/asn1_compiler.c
> > > +++ b/scripts/asn1_compiler.c
> > > @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
> > >
> > >   /* Handle string tokens */
> > >   if (isalpha(*p)) {
> > > - const char **dir, *start = p;
> > > + const char **dir;
> > >
> > >   /* Can be a directive, type name or element
> > >* name.  Find the end of the name.
> > > @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
> > >
> > >   tokens[tix++].token_type = TOKEN_TYPE_NAME;
> > >   continue;
> > > - }
> > > + } else if (isdigit(*p)) {
> > > + /* Handle numbers */
> >
> > Actually you can't do that, p is being altered in the first if statement.
>
> Yeah, you are right. I will remove this logic for v2.


I drop v1 from my tree.

Please send v2.


> >
> > >
> > > - /* Handle numbers */
> > > - if (isdigit(*p)) {
> > >   /* Find the end of the number */
> > >   q = p + 1;
> > >   while (q < nl && (isdigit(*q)))
> > >
> >
> > Regards
> > Helen
>
> Thanks!
>
> Leonardo Brás



-- 
Best Regards
Masahiro Yamada


Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-18 Thread Masahiro Yamada
On Thu, Oct 18, 2018 at 11:04 AM Leonardo Bras  wrote:
>
> Hello Helen,
>
> On Wed, Oct 17, 2018 at 12:06 AM Helen Koike  wrote:
> >
> > Hi Leonardo,
> >
> > On 10/16/18 9:09 PM, Leonardo Brás wrote:
> > > Removes an unnecessary shadowed local variable (start).
> > > Optimize test of isdigit:
> > > - If isalpha returns true, isdigit will return false, so no need to 
> > > test.
> >
> > This patch does two different things, it should be in two separated patches.
> Sure, no problem.
>
> >
> > >
> > > Signed-off-by: Leonardo Brás 
> > > ---
> > >  scripts/asn1_compiler.c | 7 +++
> > >  1 file changed, 3 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> > > index c146020fc783..08bb6e5fd6ad 100644
> > > --- a/scripts/asn1_compiler.c
> > > +++ b/scripts/asn1_compiler.c
> > > @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
> > >
> > >   /* Handle string tokens */
> > >   if (isalpha(*p)) {
> > > - const char **dir, *start = p;
> > > + const char **dir;
> > >
> > >   /* Can be a directive, type name or element
> > >* name.  Find the end of the name.
> > > @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
> > >
> > >   tokens[tix++].token_type = TOKEN_TYPE_NAME;
> > >   continue;
> > > - }
> > > + } else if (isdigit(*p)) {
> > > + /* Handle numbers */
> >
> > Actually you can't do that, p is being altered in the first if statement.
>
> Yeah, you are right. I will remove this logic for v2.


I drop v1 from my tree.

Please send v2.


> >
> > >
> > > - /* Handle numbers */
> > > - if (isdigit(*p)) {
> > >   /* Find the end of the number */
> > >   q = p + 1;
> > >   while (q < nl && (isdigit(*q)))
> > >
> >
> > Regards
> > Helen
>
> Thanks!
>
> Leonardo Brás



-- 
Best Regards
Masahiro Yamada


Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-17 Thread Leonardo Bras
Hello Helen,

On Wed, Oct 17, 2018 at 12:06 AM Helen Koike  wrote:
>
> Hi Leonardo,
>
> On 10/16/18 9:09 PM, Leonardo Brás wrote:
> > Removes an unnecessary shadowed local variable (start).
> > Optimize test of isdigit:
> > - If isalpha returns true, isdigit will return false, so no need to 
> > test.
>
> This patch does two different things, it should be in two separated patches.
Sure, no problem.

>
> >
> > Signed-off-by: Leonardo Brás 
> > ---
> >  scripts/asn1_compiler.c | 7 +++
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> > index c146020fc783..08bb6e5fd6ad 100644
> > --- a/scripts/asn1_compiler.c
> > +++ b/scripts/asn1_compiler.c
> > @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
> >
> >   /* Handle string tokens */
> >   if (isalpha(*p)) {
> > - const char **dir, *start = p;
> > + const char **dir;
> >
> >   /* Can be a directive, type name or element
> >* name.  Find the end of the name.
> > @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
> >
> >   tokens[tix++].token_type = TOKEN_TYPE_NAME;
> >   continue;
> > - }
> > + } else if (isdigit(*p)) {
> > + /* Handle numbers */
>
> Actually you can't do that, p is being altered in the first if statement.

Yeah, you are right. I will remove this logic for v2.

>
> >
> > - /* Handle numbers */
> > - if (isdigit(*p)) {
> >   /* Find the end of the number */
> >   q = p + 1;
> >   while (q < nl && (isdigit(*q)))
> >
>
> Regards
> Helen

Thanks!

Leonardo Brás


Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-17 Thread Leonardo Bras
Hello Helen,

On Wed, Oct 17, 2018 at 12:06 AM Helen Koike  wrote:
>
> Hi Leonardo,
>
> On 10/16/18 9:09 PM, Leonardo Brás wrote:
> > Removes an unnecessary shadowed local variable (start).
> > Optimize test of isdigit:
> > - If isalpha returns true, isdigit will return false, so no need to 
> > test.
>
> This patch does two different things, it should be in two separated patches.
Sure, no problem.

>
> >
> > Signed-off-by: Leonardo Brás 
> > ---
> >  scripts/asn1_compiler.c | 7 +++
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> > index c146020fc783..08bb6e5fd6ad 100644
> > --- a/scripts/asn1_compiler.c
> > +++ b/scripts/asn1_compiler.c
> > @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
> >
> >   /* Handle string tokens */
> >   if (isalpha(*p)) {
> > - const char **dir, *start = p;
> > + const char **dir;
> >
> >   /* Can be a directive, type name or element
> >* name.  Find the end of the name.
> > @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
> >
> >   tokens[tix++].token_type = TOKEN_TYPE_NAME;
> >   continue;
> > - }
> > + } else if (isdigit(*p)) {
> > + /* Handle numbers */
>
> Actually you can't do that, p is being altered in the first if statement.

Yeah, you are right. I will remove this logic for v2.

>
> >
> > - /* Handle numbers */
> > - if (isdigit(*p)) {
> >   /* Find the end of the number */
> >   q = p + 1;
> >   while (q < nl && (isdigit(*q)))
> >
>
> Regards
> Helen

Thanks!

Leonardo Brás


Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-16 Thread Helen Koike
Hi Leonardo,

On 10/16/18 9:09 PM, Leonardo Brás wrote:
> Removes an unnecessary shadowed local variable (start).
> Optimize test of isdigit:
> - If isalpha returns true, isdigit will return false, so no need to test.

This patch does two different things, it should be in two separated patches.

> 
> Signed-off-by: Leonardo Brás 
> ---
>  scripts/asn1_compiler.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> index c146020fc783..08bb6e5fd6ad 100644
> --- a/scripts/asn1_compiler.c
> +++ b/scripts/asn1_compiler.c
> @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
>  
>   /* Handle string tokens */
>   if (isalpha(*p)) {
> - const char **dir, *start = p;
> + const char **dir;
>  
>   /* Can be a directive, type name or element
>* name.  Find the end of the name.
> @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
>  
>   tokens[tix++].token_type = TOKEN_TYPE_NAME;
>   continue;
> - }
> + } else if (isdigit(*p)) {
> + /* Handle numbers */

Actually you can't do that, p is being altered in the first if statement.

>  
> - /* Handle numbers */
> - if (isdigit(*p)) {
>   /* Find the end of the number */
>   q = p + 1;
>   while (q < nl && (isdigit(*q)))
> 

Regards
Helen


Re: [Lkcamp] [PATCH 3/4] kbuild: Removes unnecessary shadowed local variable and optimize testing.

2018-10-16 Thread Helen Koike
Hi Leonardo,

On 10/16/18 9:09 PM, Leonardo Brás wrote:
> Removes an unnecessary shadowed local variable (start).
> Optimize test of isdigit:
> - If isalpha returns true, isdigit will return false, so no need to test.

This patch does two different things, it should be in two separated patches.

> 
> Signed-off-by: Leonardo Brás 
> ---
>  scripts/asn1_compiler.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
> index c146020fc783..08bb6e5fd6ad 100644
> --- a/scripts/asn1_compiler.c
> +++ b/scripts/asn1_compiler.c
> @@ -413,7 +413,7 @@ static void tokenise(char *buffer, char *end)
>  
>   /* Handle string tokens */
>   if (isalpha(*p)) {
> - const char **dir, *start = p;
> + const char **dir;
>  
>   /* Can be a directive, type name or element
>* name.  Find the end of the name.
> @@ -454,10 +454,9 @@ static void tokenise(char *buffer, char *end)
>  
>   tokens[tix++].token_type = TOKEN_TYPE_NAME;
>   continue;
> - }
> + } else if (isdigit(*p)) {
> + /* Handle numbers */

Actually you can't do that, p is being altered in the first if statement.

>  
> - /* Handle numbers */
> - if (isdigit(*p)) {
>   /* Find the end of the number */
>   q = p + 1;
>   while (q < nl && (isdigit(*q)))
> 

Regards
Helen