From: Guanqun Lu <guanqun.lu@gmail.com>
To: git@vger.kernel.org
Cc: Guanqun Lu <guanqun.lu@gmail.com>
Subject: [PATCH 1/2] code cleanup in sha1_file.c: xmalloc -> xcalloc
Date: Wed, 11 Feb 2009 14:43:31 +0800 [thread overview]
Message-ID: <1234334612-24907-1-git-send-email-guanqun.lu@gmail.com> (raw)
'xmalloc' followed immediately by 'memset' is replaced
with 'xcalloc', and a simple grep in this project seems
to show that it's the only place.
Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
---
sha1_file.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/sha1_file.c b/sha1_file.c
index 8868b80..93e5fc0 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -858,8 +858,7 @@ unsigned char* use_pack(struct packed_git *p,
static struct packed_git *alloc_packed_git(int extra)
{
- struct packed_git *p = xmalloc(sizeof(*p) + extra);
- memset(p, 0, sizeof(*p));
+ struct packed_git *p = xcalloc(1, sizeof(*p) + extra);
p->pack_fd = -1;
return p;
}
--
1.6.1.2.392.gb04d1
next reply other threads:[~2009-02-10 14:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-11 6:43 Guanqun Lu [this message]
2009-02-10 16:29 ` [PATCH 1/2] code cleanup in sha1_file.c: xmalloc -> xcalloc Brandon Casey
2009-02-10 16:43 ` Junio C Hamano
2009-02-11 6:43 ` [PATCH 2/2] lockfile: set lk->fd = -1 in 'rollback_lock_file()' Guanqun Lu
2009-02-10 15:29 ` Junio C Hamano
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=1234334612-24907-1-git-send-email-guanqun.lu@gmail.com \
--to=guanqun.lu@gmail.com \
--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).