[RFC] Remove redundant clause in condition
Sahil Siddiq
icegambit91 at gmail.com
Thu Jan 25 07:24:46 UTC 2024
output_separately is redundant in the third expression
as it's already evaluated in the second expression.
* src/strace.c (init): Remove redundancy in condition.
Signed-off-by: Sahil Siddiq <icegambit91 at gmail.com>
---
Hi,
I was going through strace's source and I came across this
boolean.
print_pid_pfx = outfname && !output_separately &&
((followfork && !output_separately) || nprocs > 1);
Since "output_separately" will be evaluated in the second
expression, I haven't understood why it's being rechecked
in the third expression with "followfork".
I thought I would send in a patch as well if this change
is valid.
Thanks,
Sahil
src/strace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/strace.c b/src/strace.c
index 9aa0eda11..d025a32c2 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -3021,7 +3021,7 @@ init(int argc, char *argv[])
* -p PID1,PID2: yes (there are already more than one pid)
*/
print_pid_pfx = outfname && !output_separately &&
- ((followfork && !output_separately) || nprocs > 1);
+ (followfork || nprocs > 1);
}
static struct tcb *
--
2.43.0
More information about the Strace-devel
mailing list