OSDN Git Service

calloc() and xcalloc() takes nmemb and then size
authorArjun Sreedharan <arjun024@gmail.com>
Sat, 30 Aug 2014 06:54:23 +0000 (12:24 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Sep 2014 21:35:37 +0000 (14:35 -0700)
There are a handful more instances of this in compat/regex/ but they
are borrowed code taht we do not want to touch with a change that
really affects correctness, which this change is not.

Signed-off-by: Arjun Sreedharan <arjun024@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/for-each-ref.c
imap-send.c

index 47bd624..69bba06 100644 (file)
@@ -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];
index 524fbab..02eb3e0 100644 (file)
@@ -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;