From edd2d8466523094c9b14762e402b0de15d68fec0 Mon Sep 17 00:00:00 2001 From: Brian Gesiak Date: Tue, 27 May 2014 00:33:43 +0900 Subject: builtin/ls-remote.c: rearrange xcalloc arguments xcalloc() takes two arguments: the number of elements and their size. cmd_ls_remote() passes the arguments in reverse order, passing the size of a char*, followed by the number of char* to be allocated. Rearrange them so they are in the correct order. Signed-off-by: Brian Gesiak Signed-off-by: Junio C Hamano --- builtin/ls-remote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 3e9eefb091..b2a4b92992 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -92,7 +92,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) if (argv[i]) { int j; - pattern = xcalloc(sizeof(const char *), argc - i + 1); + pattern = xcalloc(argc - i + 1, sizeof(const char *)); for (j = i; j < argc; j++) { int len = strlen(argv[j]); char *p = xmalloc(len + 3); -- cgit v1.2.3 From 380694544d3e5e882c0f62be372c666911c405b2 Mon Sep 17 00:00:00 2001 From: Brian Gesiak Date: Tue, 27 May 2014 00:33:44 +0900 Subject: builtin/remote.c: rearrange xcalloc arguments 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. Rearrange them so they are in the correct order. Signed-off-by: Brian Gesiak Signed-off-by: Junio C Hamano --- builtin/remote.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'builtin') diff --git a/builtin/remote.c b/builtin/remote.c index b3ab4cf8f6..9f6202167a 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); -- cgit v1.2.3