Skip to content

Commit

Permalink
reflog-walk.c: rearrange xcalloc arguments
Browse files Browse the repository at this point in the history
xcalloc() takes two arguments: the number of elements and their size.
reflog-walk.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 <modocache@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Gesiak authored and Junio C Hamano committed May 27, 2014
1 parent 48d547f commit 8e1aa2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions reflog-walk.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
static struct complete_reflogs *read_complete_reflog(const char *ref)
{
struct complete_reflogs *reflogs =
xcalloc(sizeof(struct complete_reflogs), 1);
xcalloc(1, sizeof(struct complete_reflogs));
reflogs->ref = xstrdup(ref);
for_each_reflog_ent(ref, read_one_reflog, reflogs);
if (reflogs->nr == 0) {
Expand Down Expand Up @@ -135,7 +135,7 @@ struct reflog_walk_info {

void init_reflog_walk(struct reflog_walk_info** info)
{
*info = xcalloc(sizeof(struct reflog_walk_info), 1);
*info = xcalloc(1, sizeof(struct reflog_walk_info));
}

int add_reflog_for_walk(struct reflog_walk_info *info,
Expand Down Expand Up @@ -199,7 +199,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
= reflogs;
}

commit_reflog = xcalloc(sizeof(struct commit_reflog), 1);
commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
if (recno < 0) {
commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
if (commit_reflog->recno < 0) {
Expand Down Expand Up @@ -242,7 +242,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
return;
}

commit->parents = xcalloc(sizeof(struct commit_list), 1);
commit->parents = xcalloc(1, sizeof(struct commit_list));
commit->parents->item = commit_info->commit;
}

Expand Down

0 comments on commit 8e1aa2f

Please sign in to comment.