git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: Michael LukashovNext: Michael Lukashov
Message 8 of 10 in “Refactoring: remove duplicated code”
  1. 0/4 Refactoring: remove duplicated codeMichael Lukashov, Feb 16, 2010
  2. 1/4 Refactoring: remove duplicated code from builtin-send-pack.c and transport.cMichael Lukashov, Feb 16, 2010
  3. Tay Ray ChuanFeb 17, 2010
  4. 2/4 Refactoring: connect.c: move duplicated code to a new function 'get_host_and_port'Michael Lukashov, Feb 16, 2010
  5. Larry D'AnnaFeb 17, 2010
  6. Michael LukashovFeb 17, 2010
  7. 2/4 Refactoring: connect.c: move duplicated code to a new function 'get_host_and_port'Michael Lukashov, Feb 17, 2010
  8. Junio C HamanoFeb 17, 2010
  9. 3/4 Refactoring: move duplicated code from builtin-pack-objects.c and fast-import.c to sha1_file.cMichael Lukashov, Feb 16, 2010
  10. 4/4 Refactoring: move duplicated code from builtin-checkout.c and merge-recursive.c to xdiff-interface.cMichael Lukashov, Feb 16, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.