Commit c18d206ea923da6e421752b7f9064322226dd1cc

Stefan Sperling 2019-01-28T23:17:39

simplify in_same_subdir()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/lib/fileindex.c b/lib/fileindex.c
index 8e0ead8..ae241b0 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -551,10 +551,8 @@ static int
 in_same_subdir(struct got_fileindex_entry *ie, const char *ie_name,
     const char *parent_path, size_t parent_len)
 {
-	if (!got_path_is_child(ie->path, parent_path, parent_len))
-		return 0;
-
-	return strchr(ie_name, '/') == NULL;
+	return (got_path_is_child(ie->path, parent_path, parent_len) &&
+	    strchr(ie_name, '/') == NULL);
 }
 
 /*