Substitute xmalloc()+memset(0) with xcalloc().
PATCH 1/1 Substitute xmalloc()+memset(0) with xcalloc().
Signed-off-by Peter Eriksen <[email protected]>
--- builtin-add.c | 3 +-- builtin-rm.c | 3 +-- combine-diff.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-)
builtin-add.c +1 -2
@@ -21,8 +21,7 @@ static void prune_directory(struct dir_sfor (specs =0 ; pathspec[specs]; specs++)/* nothing */ ; - seen =xmalloc (specs); -memset (seen,0 , specs); + seen =xcalloc (specs,1 ); src = dst = dir->entries; i = dir->nr;
builtin-rm.c +1 -2
@@ -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];
combine-diff.c +1 -2
@@ -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);
Signature · 1 line
1.4.2.rc1.ge7a0