Git development
 help / color / mirror / Atom feed
From: "Peter Eriksen" <s022018@student.dtu.dk>
To: git@vger.kernel.org
Subject: [PATCH] Substitute xmalloc()+memset(0) with xcalloc().
Date: Tue, 25 Jul 2006 09:30:18 +0200	[thread overview]
Message-ID: <20060725073018.GA14150@bohr.gbar.dtu.dk> (raw)

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
---
 builtin-add.c  |    3 +--
 builtin-rm.c   |    3 +--
 combine-diff.c |    3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/builtin-add.c b/builtin-add.c
index 2d25698..3a73a17 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -21,8 +21,7 @@ static void prune_directory(struct dir_s
 
 	for (specs = 0; pathspec[specs];  specs++)
 		/* nothing */;
-	seen = xmalloc(specs);
-	memset(seen, 0, specs);
+	seen = xcalloc(specs, 1);
 
 	src = dst = dir->entries;
 	i = dir->nr;
diff --git a/builtin-rm.c b/builtin-rm.c
index 5deb811..bb810ba 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -90,8 +90,7 @@ int cmd_rm(int argc, const char **argv, 
 	seen = NULL;
 	for (i = 0; pathspec[i] ; i++)
 		/* nothing */;
-	seen = xmalloc(i);
-	memset(seen, 0, i);
+	seen = xcalloc(i, 1);
 
 	for (i = 0; i < active_nr; i++) {
 		struct cache_entry *ce = active_cache[i];
diff --git a/combine-diff.c b/combine-diff.c
index 1bc1484..919112b 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -639,8 +639,7 @@ static int show_patch_diff(struct combin
 			/* deleted file */
 			result_size = 0;
 			elem->mode = 0;
-			result = xmalloc(1);
-			result[0] = 0;
+			result = xcalloc(1, 1);
 		}
 		if (0 <= fd)
 			close(fd);
-- 
1.4.2.rc1.ge7a0

                 reply	other threads:[~2006-07-25  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060725073018.GA14150@bohr.gbar.dtu.dk \
    --to=s022018@student.dtu.dk \
    --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