git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] submodule.c: use the ARRAY_SIZE macro

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Jun 27, 2014, 12:11 UTC
Message-ID
<1403871099-30620-1-git-send-email-gitter.spiros@gmail.com>

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(-)
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
Message 1 of 1 in “submodule.c: use the ARRAY_SIZE macro”
  1. submodule.c: use the ARRAY_SIZE macroElia Pinto, Jun 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.