commit 466d3b326f73598d70e55b9cf69805cb3026be55 from: Stefan Sperling date: Fri Aug 02 14:18:38 2019 UTC remove redundant strlen() calls from got_path_cmp() commit - 6f8967eb2086368b10da04b5967892b150dde24b commit + 466d3b326f73598d70e55b9cf69805cb3026be55 blob - ad3315247c0c2b5991c2ed65848a2255a310541e blob + a8c3780fee9346711ff6e8f74e29bd38320d307c --- lib/path.c +++ lib/path.c @@ -161,17 +161,19 @@ got_path_is_child(const char *child, const char *paren int got_path_cmp(const char *path1, const char *path2, size_t len1, size_t len2) { - size_t min_len = MIN(len1, len2); + size_t min_len; size_t i = 0; /* Leading directory separators are insignificant. */ - while (path1[0] == '/') + while (path1[0] == '/') { path1++; - while (path2[0] == '/') + len1--; + } + while (path2[0] == '/') { path2++; + len2--; + } - len1 = strlen(path1); - len2 = strlen(path2); min_len = MIN(len1, len2); /* Skip over common prefix. */