@matheusbsbs / matheus-bagliano / commits / 28f7581806
Fork 0

Substitute xmalloc()+memset(0) with xcalloc().

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Peter Eriksen committed Jul 25, 2006 at 09:30 UTC 28f7581806479471093b0ec021871a4343874d13
3 files changed +3 -6
builtin-add.c
+1 -2
@@ -21,8 +21,7 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
21
22 for (specs = 0; pathspec[specs]; specs++)
23 /* nothing */;
24 - seen = xmalloc(specs);
25 - memset(seen, 0, specs);
24 + seen = xcalloc(specs, 1);
25
26 src = dst = dir->entries;
27 i = dir->nr;
builtin-rm.c
+1 -2
@@ -90,8 +90,7 @@ int cmd_rm(int argc, const char **argv, char **envp)
90 seen = NULL;
91 for (i = 0; pathspec[i] ; i++)
92 /* nothing */;
93 - seen = xmalloc(i);
94 - memset(seen, 0, i);
93 + seen = xcalloc(i, 1);
94
95 for (i = 0; i < active_nr; i++) {
96 struct cache_entry *ce = active_cache[i];
combine-diff.c
+1 -2
@@ -639,8 +639,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
639 /* deleted file */
640 result_size = 0;
641 elem->mode = 0;
642 - result = xmalloc(1);
643 - result[0] = 0;
642 + result = xcalloc(1, 1);
643 }
644 if (0 <= fd)
645 close(fd);