From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> if (dir && !S_ISDIR(st.st_mode)) return false; if (!dir && S_ISDIR(st.st_mode)) return false; return true; Is the same as: return !dir == !S_ISDIR(st.st_mode); Micro-optimize the logic! Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- lib/tracefs/tracefs-instance.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/tracefs/tracefs-instance.c b/lib/tracefs/tracefs-instance.c index a8729406b9fc..012a867038b7 100644 --- a/lib/tracefs/tracefs-instance.c +++ b/lib/tracefs/tracefs-instance.c @@ -263,12 +263,7 @@ static bool check_file_exists(struct tracefs_instance *instance, if (ret < 0) return false; - if (dir && !S_ISDIR(st.st_mode)) - return false; - if (!dir && S_ISDIR(st.st_mode)) - return false; - - return true; + return !dir == !S_ISDIR(st.st_mode); } /** -- 2.25.1
![]() |