{"thread":{"id":"4977","subject":"[PATCH] Substitute xmalloc()+memset(0) with xcalloc().","startedAt":"2006-07-25T07:30:18Z","lastAt":"2006-07-25T07:30:18Z","messageCount":1,"participants":["Peter Eriksen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"24082","messageId":"20060725073018.GA14150@bohr.gbar.dtu.dk","threadId":"4977","inReplyTo":null,"subject":"[PATCH] Substitute xmalloc()+memset(0) with xcalloc().","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2006-07-25T07:30:18Z","receivedAt":"2006-07-25T07:30:18Z","isPatch":true,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>\n---\n builtin-add.c  |    3 +--\n builtin-rm.c   |    3 +--\n combine-diff.c |    3 +--\n 3 files changed, 3 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin-add.c b/builtin-add.c\nindex 2d25698..3a73a17 100644\n--- a/builtin-add.c\n+++ b/builtin-add.c\n@@ -21,8 +21,7 @@ static void prune_directory(struct dir_s\n \n \tfor (specs = 0; pathspec[specs];  specs++)\n \t\t/* nothing */;\n-\tseen = xmalloc(specs);\n-\tmemset(seen, 0, specs);\n+\tseen = xcalloc(specs, 1);\n \n \tsrc = dst = dir->entries;\n \ti = dir->nr;\ndiff --git a/builtin-rm.c b/builtin-rm.c\nindex 5deb811..bb810ba 100644\n--- a/builtin-rm.c\n+++ b/builtin-rm.c\n@@ -90,8 +90,7 @@ int cmd_rm(int argc, const char **argv, \n \tseen = NULL;\n \tfor (i = 0; pathspec[i] ; i++)\n \t\t/* nothing */;\n-\tseen = xmalloc(i);\n-\tmemset(seen, 0, i);\n+\tseen = xcalloc(i, 1);\n \n \tfor (i = 0; i < active_nr; i++) {\n \t\tstruct cache_entry *ce = active_cache[i];\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 1bc1484..919112b 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -639,8 +639,7 @@ static int show_patch_diff(struct combin\n \t\t\t/* deleted file */\n \t\t\tresult_size = 0;\n \t\t\telem->mode = 0;\n-\t\t\tresult = xmalloc(1);\n-\t\t\tresult[0] = 0;\n+\t\t\tresult = xcalloc(1, 1);\n \t\t}\n \t\tif (0 <= fd)\n \t\t\tclose(fd);\n-- \n1.4.2.rc1.ge7a0\n"}]}