git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gesiak <modocache@gmail.com>
To: GIT Mailing-list <git@vger.kernel.org>
Cc: Brian Gesiak <modocache@gmail.com>
Subject: [PATCH 11/15] notes.c: rearrange xcalloc arguments
Date: Tue, 27 May 2014 00:33:52 +0900	[thread overview]
Message-ID: <1401118436-66090-12-git-send-email-modocache@gmail.com> (raw)
In-Reply-To: <1401118436-66090-1-git-send-email-modocache@gmail.com>

xcalloc takes two arguments: the number of elements and their size.
notes.c includes several calls to xcalloc that pass the arguments in
reverse order. Rearrgange them so they are in the correct order.

Signed-off-by: Brian Gesiak <modocache@gmail.com>
---
 notes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/notes.c b/notes.c
index 5f07c0b..5fe691d 100644
--- a/notes.c
+++ b/notes.c
@@ -303,7 +303,7 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
 		free(entry);
 		return 0;
 	}
-	new_node = (struct int_node *) xcalloc(sizeof(struct int_node), 1);
+	new_node = (struct int_node *) xcalloc(1, sizeof(struct int_node));
 	ret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p),
 			       combine_notes);
 	if (ret)
@@ -443,7 +443,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
 		if (len <= 20) {
 			type = PTR_TYPE_NOTE;
 			l = (struct leaf_node *)
-				xcalloc(sizeof(struct leaf_node), 1);
+				xcalloc(1, sizeof(struct leaf_node));
 			hashcpy(l->key_sha1, object_sha1);
 			hashcpy(l->val_sha1, entry.sha1);
 			if (len < 20) {
@@ -1003,7 +1003,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
 	if (!combine_notes)
 		combine_notes = combine_notes_concatenate;
 
-	t->root = (struct int_node *) xcalloc(sizeof(struct int_node), 1);
+	t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
 	t->first_non_note = NULL;
 	t->prev_non_note = NULL;
 	t->ref = notes_ref ? xstrdup(notes_ref) : NULL;
-- 
2.0.0.rc1.543.gc8042da

  parent reply	other threads:[~2014-05-26 15:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 15:33 [PATCH 00/15] Rearrange xcalloc arguments Brian Gesiak
2014-05-26 15:33 ` [PATCH 01/15] builtin/add.c: rearrange " Brian Gesiak
2014-05-26 23:11   ` Jeremiah Mahler
2014-05-27  2:22     ` Brian Gesiak
2014-05-27  2:38       ` Jeremiah Mahler
2014-05-27  3:25   ` Eric Sunshine
2014-05-27 11:32     ` Brian Gesiak
2014-05-27 21:35       ` Eric Sunshine
2014-05-27 22:41         ` Junio C Hamano
2014-05-28  5:14         ` Jeremiah Mahler
2014-05-28  5:56           ` Brian Gesiak
2014-05-26 15:33 ` [PATCH 02/15] builtin/ls-remote.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 03/15] builtin/remote.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 04/15] commit.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 05/15] config.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 06/15] diff.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 07/15] hash.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 08/15] hash.h: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 09/15] http-push.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 10/15] imap-send.c: " Brian Gesiak
2014-06-10 21:54   ` Jeremiah Mahler
2014-05-26 15:33 ` Brian Gesiak [this message]
2014-05-26 15:33 ` [PATCH 12/15] pack-revindex.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 13/15] reflog-walk.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 14/15] remote.c: " Brian Gesiak
2014-05-26 15:33 ` [PATCH 15/15] transport-helper.c: " Brian Gesiak
2014-05-26 23:37 ` [PATCH 00/15] Rearrange " Jeremiah Mahler
2014-05-28  1:16   ` Jeff King

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=1401118436-66090-12-git-send-email-modocache@gmail.com \
    --to=modocache@gmail.com \
    --cc=git@vger.kernel.org \
    /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).