* [PATCH] perf machine: Assign boolean values to a bool variable
@ 2021-03-09 10:11 Jiapeng Chong
2021-03-09 12:10 ` Arnaldo Carvalho de Melo
2021-03-10 9:55 ` David Laight
0 siblings, 2 replies; 3+ messages in thread
From: Jiapeng Chong @ 2021-03-09 10:11 UTC (permalink / raw)
To: peterz
Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
kpsingh, linux-kernel, netdev, bpf, Jiapeng Chong
Fix the following coccicheck warnings:
./tools/perf/util/machine.c:2041:9-10: WARNING: return of 0/1 in
function 'symbol__match_regex' with return type bool.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
tools/perf/util/machine.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index b5c2d8b..435771e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2038,8 +2038,8 @@ int machine__process_event(struct machine *machine, union perf_event *event,
static bool symbol__match_regex(struct symbol *sym, regex_t *regex)
{
if (!regexec(regex, sym->name, 0, NULL, 0))
- return 1;
- return 0;
+ return true;
+ return false;
}
static void ip__resolve_ams(struct thread *thread,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf machine: Assign boolean values to a bool variable
2021-03-09 10:11 [PATCH] perf machine: Assign boolean values to a bool variable Jiapeng Chong
@ 2021-03-09 12:10 ` Arnaldo Carvalho de Melo
2021-03-10 9:55 ` David Laight
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-03-09 12:10 UTC (permalink / raw)
To: Jiapeng Chong
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
kpsingh, linux-kernel, netdev, bpf
Em Tue, Mar 09, 2021 at 06:11:09PM +0800, Jiapeng Chong escreveu:
> Fix the following coccicheck warnings:
>
> ./tools/perf/util/machine.c:2041:9-10: WARNING: return of 0/1 in
> function 'symbol__match_regex' with return type bool.
Thanks, applied.
- Arnaldo
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> tools/perf/util/machine.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index b5c2d8b..435771e 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2038,8 +2038,8 @@ int machine__process_event(struct machine *machine, union perf_event *event,
> static bool symbol__match_regex(struct symbol *sym, regex_t *regex)
> {
> if (!regexec(regex, sym->name, 0, NULL, 0))
> - return 1;
> - return 0;
> + return true;
> + return false;
> }
>
> static void ip__resolve_ams(struct thread *thread,
> --
> 1.8.3.1
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] perf machine: Assign boolean values to a bool variable
2021-03-09 10:11 [PATCH] perf machine: Assign boolean values to a bool variable Jiapeng Chong
2021-03-09 12:10 ` Arnaldo Carvalho de Melo
@ 2021-03-10 9:55 ` David Laight
1 sibling, 0 replies; 3+ messages in thread
From: David Laight @ 2021-03-10 9:55 UTC (permalink / raw)
To: 'Jiapeng Chong', peterz
Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
kpsingh, linux-kernel, netdev, bpf
From: Jiapeng Chong
> Sent: 09 March 2021 10:11
>
> Fix the following coccicheck warnings:
>
> ./tools/perf/util/machine.c:2041:9-10: WARNING: return of 0/1 in
> function 'symbol__match_regex' with return type bool.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> tools/perf/util/machine.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index b5c2d8b..435771e 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -2038,8 +2038,8 @@ int machine__process_event(struct machine *machine, union perf_event *event,
> static bool symbol__match_regex(struct symbol *sym, regex_t *regex)
> {
> if (!regexec(regex, sym->name, 0, NULL, 0))
> - return 1;
> - return 0;
> + return true;
> + return false;
What's wrong with:
return !regexec(regex, sym->name, 0, NULL, 0);
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-10 9:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 10:11 [PATCH] perf machine: Assign boolean values to a bool variable Jiapeng Chong
2021-03-09 12:10 ` Arnaldo Carvalho de Melo
2021-03-10 9:55 ` David Laight
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).