git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Lukashov <michael.lukashov@gmail.com>
To: "Larry D'Anna" <larry@elder-gods.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 2/4] Refactoring: connect.c: move duplicated code to a  new function 'get_host_and_port'
Date: Wed, 17 Feb 2010 13:02:20 +0300	[thread overview]
Message-ID: <63cde7731002170202g78a47d20l62381a8bd61e65fd@mail.gmail.com> (raw)
In-Reply-To: <20100217000456.GA28433@cthulhu>

On Wed, Feb 17, 2010 at 3:04 AM, Larry D'Anna <larry@elder-gods.org> wrote:
> * Michael Lukashov (michael.lukashov@gmail.com) [100216 18:43]:
>
>> @@ -170,30 +192,14 @@ static const char *ai_name(const struct addrinfo *ai)
>>  static int git_tcp_connect_sock(char *host, int flags)
>>  {
>>       int sockfd = -1, saved_errno = 0;
>> -     char *colon, *end;
>>       const char *port = STR(DEFAULT_GIT_PORT);
>>       struct addrinfo hints, *ai0, *ai;
>>       int gai;
>>       int cnt = 0;
>>
>> -     if (host[0] == '[') {
>> -             end = strchr(host + 1, ']');
>> -             if (end) {
>> -                     *end = 0;
>> -                     end++;
>> -                     host++;
>> -             } else
>> -                     end = host;
>> -     } else
>> -             end = host;
>> -     colon = strchr(end, ':');
>> -
>> -     if (colon) {
>> -             *colon = 0;
>> -             port = colon + 1;
>> -             if (!*port)
>> -                     port = "<none>";
>> -     }
>> +     get_host_and_port(&host, &port);
>> +     if (!*port)
>> +             *port = "<none>";
>
> Again, isn't this wrong?  This doesn't even compile for me.  Shouldn't it be
>
> port = "<none>";
>
> ??
>
> What am I missing?
>
>     --larry
>

Oops, my bad, sorry.
Strange, my mingw-gcc 4.4.0 compiler didn't issue no errors or
warnings. Weird indeed.
I'll send repaired patch later.

  reply	other threads:[~2010-02-17 10:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 23:42 [PATCH v3 0/4] Refactoring: remove duplicated code Michael Lukashov
2010-02-16 23:42 ` [PATCH v3 1/4] Refactoring: remove duplicated code from builtin-send-pack.c and transport.c Michael Lukashov
2010-02-17  2:23   ` Tay Ray Chuan
2010-02-16 23:42 ` [PATCH v3 2/4] Refactoring: connect.c: move duplicated code to a new function 'get_host_and_port' Michael Lukashov
2010-02-17  0:04   ` Larry D'Anna
2010-02-17 10:02     ` Michael Lukashov [this message]
2010-02-17 20:56     ` [PATCH v4 " Michael Lukashov
2010-02-17  0:07   ` [PATCH v3 " Junio C Hamano
2010-02-16 23:42 ` [PATCH v3 3/4] Refactoring: move duplicated code from builtin-pack-objects.c and fast-import.c to sha1_file.c Michael Lukashov
2010-02-16 23:42 ` [PATCH v3 4/4] Refactoring: move duplicated code from builtin-checkout.c and merge-recursive.c to xdiff-interface.c Michael Lukashov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63cde7731002170202g78a47d20l62381a8bd61e65fd@mail.gmail.com \
    --to=michael.lukashov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=larry@elder-gods.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).