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 <modocache@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Gesiak committed
May 27, 2014 at 00:33 UTC
8e1aa2f792b78f2528157428c7932ffa9adcbea6
1 file changed
+4
-4
reflog-walk.c
+4
-4
@@ -41,7 +41,7 @@ static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
41
static struct complete_reflogs *read_complete_reflog(const char *ref)
42
{
43
struct complete_reflogs *reflogs =
44
- xcalloc(sizeof(struct complete_reflogs), 1);
44
+ xcalloc(1, sizeof(struct complete_reflogs));
45
reflogs->ref = xstrdup(ref);
46
for_each_reflog_ent(ref, read_one_reflog, reflogs);
47
if (reflogs->nr == 0) {
@@ -135,7 +135,7 @@ struct reflog_walk_info {
135
136
void init_reflog_walk(struct reflog_walk_info** info)
137
{
138
- *info = xcalloc(sizeof(struct reflog_walk_info), 1);
138
+ *info = xcalloc(1, sizeof(struct reflog_walk_info));
139
}
140
141
int add_reflog_for_walk(struct reflog_walk_info *info,
@@ -199,7 +199,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
199
= reflogs;
200
}
201
202
- commit_reflog = xcalloc(sizeof(struct commit_reflog), 1);
202
+ commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
203
if (recno < 0) {
204
commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
205
if (commit_reflog->recno < 0) {
@@ -242,7 +242,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
242
return;
243
}
244
245
- commit->parents = xcalloc(sizeof(struct commit_list), 1);
245
+ commit->parents = xcalloc(1, sizeof(struct commit_list));
246
commit->parents->item = commit_info->commit;
247
}
248