Thread (12 messages) flat view 12 messages, 4 authors, 2016-06-15

Re: [PATCH 2/4] Extract function trim_url and optimize calls of it.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:50:35

Vasyl' Vavrychuk [off-list ref] writes:
Extract compact code into trim_url. Dont call it every iteration in the loop since no reason.
Too long a line; just drop " since no reason".
quoted hunk ↗ jump to hunk
@@ -379,14 +394,6 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 			what = rm->name;
 		}
 
-		url_len = strlen(url);
-		for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
-			;
-		url_len = i + 1;
-		if (4 < i && !strncmp(".git", url + i - 3, 4))
-			url_len = i - 3;
-		url[url_len] = '\0';
-
 		note_len = 0;
 		if (*what) {
 			if (*kind)
We repeatedly called strlen(url) for each entry in the ref-map when we
know we do not have any more thing to do; silly.  This is probably a good
thing to do.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help