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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vasyl' Vavrychuk <vvavrychuk@xxxxxxxxx> 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".

> @@ -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.
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]