Skip to content

Commit ae6ac84

Browse files
committed
Merge branch 'jc/calloc-pathspec' into maint
Minor code cleanup. * jc/calloc-pathspec: ps_matched: xcalloc() takes nmemb and then element size
2 parents 8136099 + 8b54c23 commit ae6ac84

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int checkout_paths(const struct checkout_opts *opts,
282282
if (opts->source_tree)
283283
read_tree_some(opts->source_tree, &opts->pathspec);
284284

285-
ps_matched = xcalloc(1, opts->pathspec.nr);
285+
ps_matched = xcalloc(opts->pathspec.nr, 1);
286286

287287
/*
288288
* Make sure all pathspecs participated in locating the paths

builtin/ls-files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
516516

517517
/* Treat unmatching pathspec elements as errors */
518518
if (pathspec.nr && error_unmatch)
519-
ps_matched = xcalloc(1, pathspec.nr);
519+
ps_matched = xcalloc(pathspec.nr, 1);
520520

521521
if ((dir.flags & DIR_SHOW_IGNORED) && !exc_given)
522522
die("ls-files --ignored needs some exclude pattern");

0 commit comments

Comments
 (0)