Skip to content

Commit 3806945

Browse files
modocachegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent edd2d84 commit 3806945

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/remote.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)
282282
item = string_list_insert(&branch_list, name);
283283

284284
if (!item->util)
285-
item->util = xcalloc(sizeof(struct branch_info), 1);
285+
item->util = xcalloc(1, sizeof(struct branch_info));
286286
info = item->util;
287287
if (type == REMOTE) {
288288
if (info->remote_name)
@@ -398,7 +398,7 @@ static int get_push_ref_states(const struct ref *remote_refs,
398398

399399
item = string_list_append(&states->push,
400400
abbrev_branch(ref->peer_ref->name));
401-
item->util = xcalloc(sizeof(struct push_info), 1);
401+
item->util = xcalloc(1, sizeof(struct push_info));
402402
info = item->util;
403403
info->forced = ref->force;
404404
info->dest = xstrdup(abbrev_branch(ref->name));
@@ -433,7 +433,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
433433
states->push.strdup_strings = 1;
434434
if (!remote->push_refspec_nr) {
435435
item = string_list_append(&states->push, _("(matching)"));
436-
info = item->util = xcalloc(sizeof(struct push_info), 1);
436+
info = item->util = xcalloc(1, sizeof(struct push_info));
437437
info->status = PUSH_STATUS_NOTQUERIED;
438438
info->dest = xstrdup(item->string);
439439
}
@@ -446,7 +446,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
446446
else
447447
item = string_list_append(&states->push, _("(delete)"));
448448

449-
info = item->util = xcalloc(sizeof(struct push_info), 1);
449+
info = item->util = xcalloc(1, sizeof(struct push_info));
450450
info->forced = spec->force;
451451
info->status = PUSH_STATUS_NOTQUERIED;
452452
info->dest = xstrdup(spec->dst ? spec->dst : item->string);

0 commit comments

Comments
 (0)