]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/calloc-pathspec' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:00 +0000 (19:18 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Sep 2015 02:18:00 +0000 (19:18 -0700)
Minor code cleanup.

* jc/calloc-pathspec:
  ps_matched: xcalloc() takes nmemb and then element size

builtin/checkout.c
builtin/ls-files.c

index f71844a23a9d4bda0664bec709648911bc0f2609..3b6e4999299484d30a41e0d787086a367ee70e5c 100644 (file)
@@ -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
index 6fa2205734e435c9db787193dcf8c0392d9d2a24..b6a7cb0c7c48293c6348806cb342a9289f146740 100644 (file)
@@ -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");