Thread (27 messages) flat view 27 messages, 4 authors, 2016-06-15
STALE3736d

[PATCH 13/15] reflog-walk.c: rearrange xcalloc arguments

From: Brian Gesiak <hidden>
Date: 2016-06-15 23:01:22
Subsystem: the rest · Maintainer: Linus Torvalds

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. Rearrgange them so they are in the correct order.

Signed-off-by: Brian Gesiak <redacted>
---
 reflog-walk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index b2fbdb2..f8d8f13 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -45,7 +45,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) {
@@ -143,7 +143,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,
@@ -207,7 +207,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) {
@@ -250,7 +250,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;
 }
 
-- 
2.0.0.rc1.543.gc8042da
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help