Re: [PATCH v3 2/4] Refactoring: connect.c: move duplicated code to a new function 'get_host_and_port'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 17, 2010, 00:07 UTC
- Message-ID
- <7vaav8ybag.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <0d6d0066fecc892bd5b6afda64e1aa5591347504.1266360267.git.michael.lukashov@gmail.com>
Michael Lukashov <michael.lukashov@gmail.com> writes:
Show 9 quoted lines
> The following functions: > > git_tcp_connect_sock (IPV6 version) > git_tcp_connect_sock (no IPV6 version), > git_proxy_connect > > have common block of code. Move it to a new function 'get_host_and_port' > > Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Show 12 quoted lines
> @@ -170,30 +192,14 @@ static const char *ai_name(const struct addrinfo *ai)
> static int git_tcp_connect_sock(char *host, int flags)
> ...
> - if (colon) {
> - *colon = 0;
> - port = colon + 1;
> - if (!*port)
> - port = "<none>";
> - }
> + get_host_and_port(&host, &port);
> + if (!*port)
> + *port = "<none>";Is this version any different from v2?
I expected that at least this one would have been fixed from the older version.