perf script: remove unneeded conversion to bool
PATCH 1/1 perf script: remove unneeded conversion to bool
This issue was detected by using the Coccinelle software:
tools/perf/builtin-script.c:3285:48-53: WARNING: conversion to bool not needed here tools/perf/builtin-script.c:2839:36-41: WARNING: conversion to bool not needed here
The conversion to bool is unneeded, remove it
--- tools/perf/builtin-script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-script.c +2 -2
@@ -2836,7 +2836,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused,break ; }if (i == imax &&strcmp (tok,"flags" ) ==0 ) { - print_flags = change ==REMOVE ? false : true; + print_flags = change ==REMOVE ;continue ; }if (i == imax) {
@@ -3282,7 +3282,7 @@ static char *get_script_path(const char *script_root, const char *suffix)static bool is_top_script (const char *script_path) { -return ends_with (script_path,"top" ) ==NULL ? false : true; +return ends_with (script_path,"top" ) ==NULL ; }static int has_required_arg (char *script_path)
Signature · 1 line
2.6.2
Quoted 6 lines · Zou Wei
This issue was detected by using the Coccinelle software:
tools/perf/builtin-script.c:3285:48-53: WARNING: conversion to bool not needed here tools/perf/builtin-script.c:2839:36-41: WARNING: conversion to bool not needed here
The conversion to bool is unneeded, remove it
[]
tools/perf/builtin-script.c
Quoted 1 line
tools/perf/builtin-script.c +0
-0
[]
tools/perf/builtin-script.c static int parse_output_fields(const struct option *opt __maybe_unused, · line 2839
Quoted 6 lines
tools/perf/builtin-script.c +1
-1@@ -2836,7 +2836,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused,break ; }if (i == imax &&strcmp (tok,"flags" ) ==0 ) { - print_flags = change ==REMOVE ? false : true; + print_flags = change ==REMOVE ;
Read the deleted code above this again.
(you have inverted the logic)
tools/perf/builtin-script.c static char *get_script_path(const char *script_root, const char *suffix) · line 3285
Quoted 9 lines
tools/perf/builtin-script.c +1
-1continue ; }if (i == imax) {@@ -3282,7 +3282,7 @@ static char *get_script_path(const char *script_root, const char *suffix)static bool is_top_script (const char *script_path) { -return ends_with (script_path,"top" ) ==NULL ? false : true; +return ends_with (script_path,"top" ) ==NULL ;
and here.
Arnaldo Carvalho de Melo
AppliedEm Sun, Apr 26, 2020 at 08:31:05PM +0800, Zou Wei escreveu:
Quoted 6 lines
This issue was detected by using the Coccinelle software:
tools/perf/builtin-script.c:3285:48-53: WARNING: conversion to bool not needed here tools/perf/builtin-script.c:2839:36-41: WARNING: conversion to bool not needed here
The conversion to bool is unneeded, remove it
Thanks, applied,
- Arnaldo
Quoted 9 lines · Arnaldo Carvalho de Melo
Em Sun, Apr 26, 2020 at 08:31:05PM +0800, Zou Wei escreveu:
Quoted 6 lines
This issue was detected by using the Coccinelle software:
tools/perf/builtin-script.c:3285:48-53: WARNING: conversion to bool not needed here tools/perf/builtin-script.c:2839:36-41: WARNING: conversion to bool not needed here
The conversion to bool is unneeded, remove it
Thanks, applied,
Did you read the patch?
It's broken, unless some other patch was applied.
Quoted 7 lines · Joe Perches
Quoted 4 lines · Arnaldo Carvalho de Melo
Em Sun, Apr 26, 2020 at 08:31:05PM +0800, Zou Wei escreveu:
Quoted 3 lines
This issue was detected by using the Coccinelle software:
tools/perf/builtin-script.c:3285:48-53: WARNING: conversion to bool
not needed here
Quoted 1 line
Quoted 1 line
tools/perf/builtin-script.c:2839:36-41: WARNING: conversion to bool
Quoted 8 lines
not needed here
Quoted 4 lines
Quoted 2 lines
The conversion to bool is unneeded, remove it
Thanks, applied,
Did you read the patch?
It's broken, unless some other patch was applied.
Of course I read it, but yeah, I made a mistake, thanks for pointing out, I'll remove it, thanks.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.