All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] cmd_fetch_pack(): fix constness problem and memory leak
Date: Mon, 21 May 2012 10:13:48 +0200	[thread overview]
Message-ID: <4FB9F93C.4010308@alum.mit.edu> (raw)
In-Reply-To: <7vk4069ug8.fsf@alter.siamese.dyndns.org>

On 05/21/2012 03:47 AM, Junio C Hamano wrote:
> mhagger@alum.mit.edu writes:
>
>> I understand that it is not crucial to free memory allocated in a
>> cmd_*() function but it is unclear to me whether it is *preferred* to
>> let the process clean up take care of things.
>
> Traditionally, the cmd_foo() functions roughly correspond to main() in
> other programs, so from that point of view, "it is not crucial to free" is
> an understatement. It is not even worth wasting people's time to (1)
> decide which way is *preferred* and to (2) churn the code only to match
> whichever way.

OK, thanks for the info.  I will remove the "freeing-memory" part of the 
patch.

> If you have a plan to split cmd_fetch_pack() and make other parts of the
> system call it, [...]

No, I have no plans for cmd_fetch_pack() besides cleaning up the 
constness errors that I found when randomly reading the code.

> It also seems that some cruft has snuck into this patch, e.g. like this
> part,
>
>> -	int i, ret, nr_heads;
>> +	int i, ret;
>
> that do not have anything to do with "fix constness" nor "memory leak".

This particular hunk is part of moving alloc_heads, nr_heads, and heads 
together to make it more obvious that they are part of an ALLOC_GROW 
triplet.  Previously alloc_heads was a block-local variable used only in 
the case of the --stdin option.

But I admit that the patch is harder than necessary to read because of 
the indentation changes etc, so I will break it up into more digestible 
quanta.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  reply	other threads:[~2012-05-21  8:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 10:40 [PATCH 0/2] Fix some constness errors in fetch-pack mhagger
2012-05-02 10:40 ` [PATCH 1/2] cmd_fetch_pack(): declare dest to be const mhagger
2012-05-02 10:40 ` [PATCH 2/2] cmd_fetch_pack(): fix constness problem and memory leak mhagger
2012-05-02 11:14   ` Nguyen Thai Ngoc Duy
2012-05-02 13:35     ` Michael Haggerty
2012-05-02 14:38       ` [PATCH 0/3] Fix some constness errors in fetch-pack and parseopt conversion Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 1/3] cmd_fetch_pack(): declare dest to be const Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 2/3] fetch-pack: use parse_options() Nguyễn Thái Ngọc Duy
2012-05-02 14:38         ` [PATCH 3/3] cmd_fetch_pack(): fix constness problem and memory leak Nguyễn Thái Ngọc Duy
2012-05-02 17:14     ` [PATCH 2/2] " Junio C Hamano
2012-05-21  1:47   ` Junio C Hamano
2012-05-21  8:13     ` Michael Haggerty [this message]
2012-05-19 14:05 ` [PATCH 0/2] Fix some constness errors in fetch-pack Michael Haggerty

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=4FB9F93C.4010308@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.