2023-12-08 00:16:39

by Jim Cromie

[permalink] [raw]
Subject: [re: PATCH v2 00/15 - 07/11] dyndbg: __skip_spaces

This private version treats a comma like a space.
Its not known necessary ATM, but seems prudent.

Signed-off-by: Jim Cromie <[email protected]>
---
lib/dynamic_debug.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index a380b8151dd8..c974f6e19ca1 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -628,6 +628,14 @@ static int ddebug_change(const struct ddebug_query *query,
return nfound;
}

+char *__skip_spaces(const char *str)
+{
+ str = skip_spaces(str);
+ if (*str == ',')
+ str = skip_spaces(++str);
+ return (char *)str;
+}
+
/*
* Split the buffer `buf' into space-separated words.
* Handles simple " and ' quoting, i.e. without nested,
@@ -642,7 +650,7 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
char *end;

/* Skip leading whitespace */
- buf = skip_spaces(buf);
+ buf = __skip_spaces(buf);
if (!*buf)
break; /* oh, it was trailing whitespace */
if (*buf == '#')
@@ -959,7 +967,7 @@ static int ddebug_exec_queries(char *query, const char *modname)
if (split)
*split++ = '\0';

- query = skip_spaces(query);
+ query = __skip_spaces(query);
if (!query || !*query || *query == '#')
continue;

--
2.43.0


2023-12-18 17:22:07

by Petr Mladek

[permalink] [raw]
Subject: Re: [re: PATCH v2 00/15 - 07/11] dyndbg: __skip_spaces

On Thu 2023-12-07 17:15:10, Jim Cromie wrote:
> This private version treats a comma like a space.

Please, make it clear that this patch adds a new function.
Also please explain why it is needed and what are the effects.

> Its not known necessary ATM, but seems prudent.

It might be that I am not a native speaker but I can't parse
the above sentence at all.

What is not known?
What is prudent?


> Signed-off-by: Jim Cromie <[email protected]>
> ---
> lib/dynamic_debug.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index a380b8151dd8..c974f6e19ca1 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -628,6 +628,14 @@ static int ddebug_change(const struct ddebug_query *query,
> return nfound;
> }
>
> +char *__skip_spaces(const char *str)
> +{
> + str = skip_spaces(str);
> + if (*str == ',')
> + str = skip_spaces(++str);
> + return (char *)str;
> +}

The function should not be called "skip_spaces" when it skips also
characters which are not typical white-space characters.

Also the "__" are usually used the other way around. func()
is usually a wrapper around __func().

Please, use another name. If you can't find a good name then
it suggests that the design is bad. The result would likely
be hard to understand and maintain.

Best Regards,
Petr

PS: I am sorry, I do not have time for a proper review. I primary wanted
to check if the patchset somehow affected printk(). And I realized
that I do not understand what the changes are about. The commit
messages and the motivation might make sense only to people who
know the big picture. But I was not able to get the picture
for the changes in dot,comma,space handling.

2023-12-21 15:26:54

by Łukasz Bartosik

[permalink] [raw]
Subject: Re: [re: PATCH v2 00/15 - 07/11] dyndbg: __skip_spaces

pon., 18 gru 2023 o 18:17 Petr Mladek <[email protected]> napisał(a):
>
> On Thu 2023-12-07 17:15:10, Jim Cromie wrote:
> > This private version treats a comma like a space.
>
> Please, make it clear that this patch adds a new function.
> Also please explain why it is needed and what are the effects.
>
> > Its not known necessary ATM, but seems prudent.
>
> It might be that I am not a native speaker but I can't parse
> the above sentence at all.
>
> What is not known?
> What is prudent?
>
>
> > Signed-off-by: Jim Cromie <[email protected]>
> > ---
> > lib/dynamic_debug.c | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> > index a380b8151dd8..c974f6e19ca1 100644
> > --- a/lib/dynamic_debug.c
> > +++ b/lib/dynamic_debug.c
> > @@ -628,6 +628,14 @@ static int ddebug_change(const struct ddebug_query *query,
> > return nfound;
> > }
> >
> > +char *__skip_spaces(const char *str)
> > +{
> > + str = skip_spaces(str);
> > + if (*str == ',')
> > + str = skip_spaces(++str);
> > + return (char *)str;
> > +}
>
> The function should not be called "skip_spaces" when it skips also
> characters which are not typical white-space characters.
>
> Also the "__" are usually used the other way around. func()
> is usually a wrapper around __func().
>
> Please, use another name. If you can't find a good name then
> it suggests that the design is bad. The result would likely
> be hard to understand and maintain.
>

I will update the commit based on your comments.

Thanks,
Lukasz

> Best Regards,
> Petr
>
> PS: I am sorry, I do not have time for a proper review. I primary wanted
> to check if the patchset somehow affected printk(). And I realized
> that I do not understand what the changes are about. The commit
> messages and the motivation might make sense only to people who
> know the big picture. But I was not able to get the picture
> for the changes in dot,comma,space handling.