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

[PATCH] fix calloc() and xcalloc() argument ordering

From
Arjun Sreedharan <arjun024@gmail.com>
Date
Sep 4, 2014, 14:03 UTC
Message-ID
<1409839395-1902-1-git-send-email-arjun024@gmail.com>
In-Reply-To
<xmqqegvt27ac.fsf@gitster.dls.corp.google.com>
@number first, @size second argument.
Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
---
 builtin/for-each-ref.c | 2 +-
 imap-send.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 47bd624..69bba06 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -633,7 +633,7 @@ static void populate_value(struct refinfo *ref)
 	unsigned long size;
 	const unsigned char *tagged;
 
-	ref->value = xcalloc(sizeof(struct atom_value), used_atom_cnt);
+	ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
 
 	if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
 		unsigned char unused1[20];
diff --git a/imap-send.c b/imap-send.c
index 524fbab..02eb3e0 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -954,7 +954,7 @@ static struct imap_store *imap_open_store(struct imap_server_conf *srvc)
 
 	ctx = xcalloc(1, sizeof(*ctx));
 
-	ctx->imap = imap = xcalloc(sizeof(*imap), 1);
+	ctx->imap = imap = xcalloc(1, sizeof(*imap));
 	imap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1;
 	imap->in_progress_append = &imap->in_progress;
 
-- 
1.8.1.msysgit.1
Previous: Arjun Sreedharan
Message 4 of 4 in “fix calloc() and xcalloc() argument ordering”
  1. fix calloc() and xcalloc() argument orderingArjun Sreedharan, Aug 30, 2014
  2. Junio C HamanoSep 2, 2014
  3. Arjun SreedharanSep 3, 2014
  4. fix calloc() and xcalloc() argument orderingArjun Sreedharan, Sep 4, 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.