From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org, Jens.Lehmann@web.de, hvoigt@hvoigt.net
Subject: Re: [PATCH 5/7] submodule: implement `module_list` as a builtin helper
Date: Wed, 19 Aug 2015 11:22:02 -0700 [thread overview]
Message-ID: <xmqqfv3f9m0l.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqpp2j9m7g.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Wed, 19 Aug 2015 11:17:55 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Micronit. Even though multiplication is commutative, the order of
> arguments to xcalloc() looks odd. It lets you say "I want an array
> with nmemb elements, and each of its is size-bytes long" by giving
> it nmemb and then size.
Unrelated tangent, but while I have output from "git grep 'calloc.*pathspec'"
on my screen... ;-)
builtin/checkout.c | 2 +-
builtin/ls-files.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 7ea533e..e3b28e4 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -283,7 +283,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
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 6fa2205..b6a7cb0 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -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");
next prev parent reply other threads:[~2015-08-19 18:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-18 0:21 [PATCH 0/7] Submodule improvements Stefan Beller
2015-08-18 0:21 ` [PATCH 1/7] submodule: implement a config API for lookup of .gitmodules values Stefan Beller
2015-08-18 0:21 ` [PATCH 2/7] submodule: extract functions for config set and lookup Stefan Beller
2015-08-18 0:21 ` [PATCH 3/7] submodule: use new config API for worktree configurations Stefan Beller
2015-08-18 0:22 ` [PATCH 4/7] submodule: Allow errornous values for the fetchrecursesubmodules option Stefan Beller
2015-08-19 18:09 ` Junio C Hamano
2015-08-18 0:22 ` [PATCH 5/7] submodule: implement `module_list` as a builtin helper Stefan Beller
2015-08-19 18:17 ` Junio C Hamano
2015-08-19 18:22 ` Junio C Hamano [this message]
2015-08-19 18:25 ` Stefan Beller
2015-08-19 18:23 ` Stefan Beller
2015-08-18 0:22 ` [PATCH 6/7] submodule: implement `module_name` " Stefan Beller
2015-08-18 0:22 ` [PATCH 7/7] submodule: implement `module_clone` " Stefan Beller
2015-08-18 0:26 ` Stefan Beller
2015-08-18 22:13 ` Stefan Beller
2015-08-19 19:08 ` Junio C Hamano
2015-08-19 19:20 ` Stefan Beller
2015-08-21 14:22 ` Jeff King
2015-08-18 0:38 ` [PATCH 0/7] Submodule improvements Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfv3f9m0l.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).