Skip to content

Commit

Permalink
Merge branch 'jc/calloc-pathspec' into maint
Browse files Browse the repository at this point in the history
Minor code cleanup.

* jc/calloc-pathspec:
  ps_matched: xcalloc() takes nmemb and then element size
  • Loading branch information
Junio C Hamano committed Sep 4, 2015
2 parents 8136099 + 8b54c23 commit ae6ac84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static int checkout_paths(const struct checkout_opts *opts,
if (opts->source_tree)
read_tree_some(opts->source_tree, &opts->pathspec);

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

/*
* Make sure all pathspecs participated in locating the paths
Expand Down
2 changes: 1 addition & 1 deletion builtin/ls-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)

/* Treat unmatching pathspec elements as errors */
if (pathspec.nr && error_unmatch)
ps_matched = xcalloc(1, pathspec.nr);
ps_matched = xcalloc(pathspec.nr, 1);

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

0 comments on commit ae6ac84

Please sign in to comment.