Skip to content

Commit 8e1aa2f

Browse files
modocachegitster
authored andcommitted
reflog-walk.c: rearrange xcalloc arguments
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48d547f commit 8e1aa2f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

reflog-walk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
4141
static struct complete_reflogs *read_complete_reflog(const char *ref)
4242
{
4343
struct complete_reflogs *reflogs =
44-
xcalloc(sizeof(struct complete_reflogs), 1);
44+
xcalloc(1, sizeof(struct complete_reflogs));
4545
reflogs->ref = xstrdup(ref);
4646
for_each_reflog_ent(ref, read_one_reflog, reflogs);
4747
if (reflogs->nr == 0) {
@@ -135,7 +135,7 @@ struct reflog_walk_info {
135135

136136
void init_reflog_walk(struct reflog_walk_info** info)
137137
{
138-
*info = xcalloc(sizeof(struct reflog_walk_info), 1);
138+
*info = xcalloc(1, sizeof(struct reflog_walk_info));
139139
}
140140

141141
int add_reflog_for_walk(struct reflog_walk_info *info,
@@ -199,7 +199,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
199199
= reflogs;
200200
}
201201

202-
commit_reflog = xcalloc(sizeof(struct commit_reflog), 1);
202+
commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
203203
if (recno < 0) {
204204
commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
205205
if (commit_reflog->recno < 0) {
@@ -242,7 +242,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
242242
return;
243243
}
244244

245-
commit->parents = xcalloc(sizeof(struct commit_list), 1);
245+
commit->parents = xcalloc(1, sizeof(struct commit_list));
246246
commit->parents->item = commit_info->commit;
247247
}
248248

0 commit comments

Comments
 (0)