From: Michael Haggerty <mhagger@xxxxxxxxxxxx> Save a bunch of lines of code and a couple of strlen() calls. Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- refs.c | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-) diff --git a/refs.c b/refs.c index ada691b..4bc6041 100644 --- a/refs.c +++ b/refs.c @@ -1096,19 +1096,10 @@ static int remove_empty_directories(const char *file) */ static int names_conflict(const char *refname1, const char *refname2) { - int len1 = strlen(refname1); - int len2 = strlen(refname2); - int cmplen; - const char *lead; - - if (len1 < len2) { - cmplen = len1; - lead = refname2; - } else { - cmplen = len2; - lead = refname1; - } - return !strncmp(refname1, refname2, cmplen) && lead[cmplen] == '/'; + for (; *refname1 && *refname1 == *refname2; refname1++, refname2++) + ; + return (*refname1 == '\0' && *refname2 == '/') + || (*refname1 == '/' && *refname2 == '\0'); } /* -- 1.7.7 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html