summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eriksen <s022018@student.dtu.dk>2006-07-25 09:30:18 +0200
committerJunio C Hamano <junkio@cox.net>2006-07-25 14:08:09 -0700
commit28f7581806479471093b0ec021871a4343874d13 (patch)
tree4d87706c1a09a113d1e0d887560b1b5b044cc24a
parent143c89b00348759d2768003d57e0f506d281dc61 (diff)
downloadgit-28f7581806479471093b0ec021871a4343874d13.tar.gz
Substitute xmalloc()+memset(0) with xcalloc().
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--builtin-add.c3
-rw-r--r--builtin-rm.c3
-rw-r--r--combine-diff.c3
3 files changed, 3 insertions, 6 deletions
diff --git a/builtin-add.c b/builtin-add.c
index 2d25698173..3a73a173f7 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -21,8 +21,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
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 5deb811719..bb810ba41a 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -90,8 +90,7 @@ int cmd_rm(int argc, const char **argv, char **envp)
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 1bc1484645..919112bba9 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -639,8 +639,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
/* deleted file */
result_size = 0;
elem->mode = 0;
- result = xmalloc(1);
- result[0] = 0;
+ result = xcalloc(1, 1);
}
if (0 <= fd)
close(fd);