Skip to contentSkip to conversation

perf machine: Assign boolean values to a bool variable

PATCH New Jiapeng Chong 1 participant 1 message Mar 11, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 perf machine: Assign boolean values to a bool variable

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.

---
Changes in v2:
- Make code simpler.

 tools/perf/util/machine.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/perf/util/machine.c +1 -3
index b5c2d8b..ba6517b 100644
@@ -2037,9 +2037,7 @@ 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 !regexec(regex, sym->name, 0, NULL, 0);
 }
 
 static void ip__resolve_ams(struct thread *thread,
Signature · 1 line
1.8.3.1