git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 03/15] builtin/remote.c: rearrange xcalloc arguments

From
Brian Gesiak <modocache@gmail.com>
Date
May 26, 2014, 15:33 UTC
Message-ID
<1401118436-66090-4-git-send-email-modocache@gmail.com>
In-Reply-To
<1401118436-66090-1-git-send-email-modocache@gmail.com>

xcalloc takes two arguments: the number of elements and their size. builtin/remote.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>
---
 builtin/remote.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index b3ab4cf..9f62021 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -282,7 +282,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)
 		item = string_list_insert(&branch_list, name);
 
 		if (!item->util)
-			item->util = xcalloc(sizeof(struct branch_info), 1);
+			item->util = xcalloc(1, sizeof(struct branch_info));
 		info = item->util;
 		if (type == REMOTE) {
 			if (info->remote_name)
@@ -398,7 +398,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
 
 		item = string_list_append(&states->push,
 					  abbrev_branch(ref->peer_ref->name));
-		item->util = xcalloc(sizeof(struct push_info), 1);
+		item->util = xcalloc(1, sizeof(struct push_info));
 		info = item->util;
 		info->forced = ref->force;
 		info->dest = xstrdup(abbrev_branch(ref->name));
@@ -433,7 +433,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
 	states->push.strdup_strings = 1;
 	if (!remote->push_refspec_nr) {
 		item = string_list_append(&states->push, _("(matching)"));
-		info = item->util = xcalloc(sizeof(struct push_info), 1);
+		info = item->util = xcalloc(1, sizeof(struct push_info));
 		info->status = PUSH_STATUS_NOTQUERIED;
 		info->dest = xstrdup(item->string);
 	}
@@ -446,7 +446,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
 		else
 			item = string_list_append(&states->push, _("(delete)"));
 
-		info = item->util = xcalloc(sizeof(struct push_info), 1);
+		info = item->util = xcalloc(1, sizeof(struct push_info));
 		info->forced = spec->force;
 		info->status = PUSH_STATUS_NOTQUERIED;
 		info->dest = xstrdup(spec->dst ? spec->dst : item->string);
-- 
2.0.0.rc1.543.gc8042da
Previous: Brian GesiakNext: Brian Gesiak
Message 13 of 28 in “Rearrange xcalloc arguments”
  1. 00/15 Rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  2. 01/15 builtin/add.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  3. Jeremiah MahlerMay 26, 2014
  4. Brian GesiakMay 27, 2014
  5. Jeremiah MahlerMay 27, 2014
  6. Eric SunshineMay 27, 2014
  7. Brian GesiakMay 27, 2014
  8. Eric SunshineMay 27, 2014
  9. Junio C HamanoMay 27, 2014
  10. Jeremiah MahlerMay 28, 2014
  11. Brian GesiakMay 28, 2014
  12. 02/15 builtin/ls-remote.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  13. 03/15 builtin/remote.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  14. 04/15 commit.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  15. 05/15 config.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  16. 06/15 diff.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  17. 07/15 hash.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  18. 08/15 hash.h: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  19. 09/15 http-push.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  20. 10/15 imap-send.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  21. Jeremiah MahlerJun 10, 2014
  22. 11/15 notes.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  23. 12/15 pack-revindex.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  24. 13/15 reflog-walk.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  25. 14/15 remote.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  26. 15/15 transport-helper.c: rearrange xcalloc argumentsBrian Gesiak, May 26, 2014
  27. Jeremiah MahlerMay 26, 2014
  28. Jeff KingMay 28, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.