threads / patch / 37009

patchsubmodule.c: use the ARRAY_SIZE macro

Subject: [PATCH] submodule.c: use the ARRAY_SIZE macro

## tl;dr

One message between Jun 27, 2014 and Jun 27, 2014. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Elia Pinto· Jun 27, 2014, 12:11 UTC · lore

Use the ARRAY_SIZE macro to get the number of elements in an array.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
---
 submodule.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to submodule.c +1 −1
diff --git a/submodule.c b/submodule.c
index b80ecac..48e3b44 100644
--- a/submodule.c
+++ b/submodule.c
@@ -965,7 +965,7 @@ static int find_first_merges(struct object_array *result, const char *path,
 			sha1_to_hex(a->object.sha1));
 	init_revisions(&revs, NULL);
 	rev_opts.submodule = path;
-	setup_revisions(sizeof(rev_args)/sizeof(char *)-1, rev_args, &revs, &rev_opts);
+	setup_revisions(ARRAY_SIZE(rev_args)-1, rev_args, &revs, &rev_opts);
 
 	/* save all revisions from the above list that contain b */
 	if (prepare_revision_walk(&revs))
-- 
1.7.10.4

← back to recent threads