From: Ray Chuan <rctay89@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] http-push: refactor request url creation
Date: Mon, 26 Jan 2009 09:52:22 +0800 [thread overview]
Message-ID: <be6fef0d0901251752p5b34c053pb24dce8a35b06fce@mail.gmail.com> (raw)
In-Reply-To: <7vpribdszr.fsf@gitster.siamese.dyndns.org>
Hi,
On Mon, Jan 26, 2009 at 4:35 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -304,17 +312,7 @@ static void start_fetch_loose(struct
>> transfer_request *request)
>>
>> git_SHA1_Init(&request->c);
>>
>> - url = xmalloc(strlen(remote->url) + 50);
>> ...
>> - strcpy(request->url, url);
>> + request->url = get_remote_object_url(remote->url, hex, 0);
>> ...
>> - curl_easy_setopt(slot->curl, CURLOPT_URL, url);
>> + curl_easy_setopt(slot->curl, CURLOPT_URL, request->url);
>
> The original code gave a separate "url" to setop() but this gives the same
> string. Does curl_easy_setop() copies the given string away? IOW is this
> change safe?
>
curl strdup's it, so this is safe.
The stack is like this:
curl_easy_setopt
calls Curl_setopt (at 391)
calls setstropt (at 1566)
calls strdup (at 276).
http://cool.haxx.se/cvs.cgi/curl/lib/easy.c?annotate=1.132 (for
curl_easy_setopt)
http://cool.haxx.se/cvs.cgi/curl/lib/url.c?annotate=1.782 (for
Curl_setopt, setstropt)
--
Cheers,
Ray Chuan
next prev parent reply other threads:[~2009-01-26 1:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 6:08 [PATCH] http-push: refactor request url creation Ray Chuan
2009-01-25 20:35 ` Junio C Hamano
2009-01-26 1:52 ` Ray Chuan [this message]
2009-01-26 8:02 ` Daniel Stenberg
2009-01-26 10:41 ` Johannes Schindelin
2009-01-27 4:58 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2009-01-28 22:19 Tay Ray Chuan
2009-01-28 22:51 ` Junio C Hamano
2009-01-28 23:06 ` Johannes Schindelin
2009-01-29 11:49 ` Tay Ray Chuan
2009-01-30 23:51 Tay Ray Chuan
2009-02-01 0:55 ` Junio C Hamano
2009-02-01 22:45 ` Johannes Schindelin
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=be6fef0d0901251752p5b34c053pb24dce8a35b06fce@mail.gmail.com \
--to=rctay89@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).