Skip to content

Commit 65bbf08

Browse files
modocachegitster
authored andcommitted
notes.c: rearrange xcalloc arguments
xcalloc() takes two arguments: the number of elements and their size. notes.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 3345c0f commit 65bbf08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

notes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
303303
free(entry);
304304
return 0;
305305
}
306-
new_node = (struct int_node *) xcalloc(sizeof(struct int_node), 1);
306+
new_node = (struct int_node *) xcalloc(1, sizeof(struct int_node));
307307
ret = note_tree_insert(t, new_node, n + 1, l, GET_PTR_TYPE(*p),
308308
combine_notes);
309309
if (ret)
@@ -443,7 +443,7 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
443443
if (len <= 20) {
444444
type = PTR_TYPE_NOTE;
445445
l = (struct leaf_node *)
446-
xcalloc(sizeof(struct leaf_node), 1);
446+
xcalloc(1, sizeof(struct leaf_node));
447447
hashcpy(l->key_sha1, object_sha1);
448448
hashcpy(l->val_sha1, entry.sha1);
449449
if (len < 20) {
@@ -1003,7 +1003,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
10031003
if (!combine_notes)
10041004
combine_notes = combine_notes_concatenate;
10051005

1006-
t->root = (struct int_node *) xcalloc(sizeof(struct int_node), 1);
1006+
t->root = (struct int_node *) xcalloc(1, sizeof(struct int_node));
10071007
t->first_non_note = NULL;
10081008
t->prev_non_note = NULL;
10091009
t->ref = notes_ref ? xstrdup(notes_ref) : NULL;

0 commit comments

Comments
 (0)