git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] fixup! 8e00b48 don't allocate struct wt_status_state dynamically
Date: Thu, 14 Jun 2012 10:13:54 -0700	[thread overview]
Message-ID: <7vy5nperzh.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20099.6449254037$1339662032@news.gmane.org> (y.'s message of "Thu, 14 Jun 2012 10:20:13 +0200")

y@imag.fr writes:

> From: Matthieu Moy <Matthieu.Moy@imag.fr>
>
> The common
>
> void function() {
> 	struct wt_status_state *state = calloc(...);
> 	...
> 	free(state);
> }
>
> is essentially a less efficient, and more error prone way of allocating a
> variable on the stack (plus, the calloc should have been a xcalloc).
> Replace it with an on-stack variable.
>
> While we're there, also replace the individual initializations of fields
> with memset(..., 0, ...).
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
>
> (BTW, I didn't find a way to have both --autosquash-compliant and
> meaningfull titles)
>
>  wt-status.c | 49 +++++++++++++++++++++----------------------------
>  1 file changed, 21 insertions(+), 28 deletions(-)

Thanks; much better.

  reply	other threads:[~2012-06-14 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13 23:01 What's cooking in git.git (Jun 2012, #03; Wed, 13) Junio C Hamano
2012-06-14  8:18 ` lk/more-helpful-status-hints (was Re: What's cooking in git.git (Jun 2012, #03; Wed, 13)) Matthieu Moy
2012-06-14  8:20 ` [PATCH 1/2] fixup! 8e00b48 don't allocate struct wt_status_state dynamically y
2012-06-14 17:13   ` Junio C Hamano [this message]
2012-06-14  8:20 ` y
2012-06-14  8:20   ` [PATCH 2/2] fixup! 38388c8 reword message when splitting a commit y
2012-06-14  8:20   ` y
2012-06-14  8:23   ` [PATCH 1/2] fixup! 8e00b48 don't allocate struct wt_status_state dynamically Matthieu Moy

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=7vy5nperzh.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.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).