Thread (1 message) 1 message, 1 author, 2026-02-04

Re: [PATCH 02/11] config-batch: create parse loop and unknown command

From: Junio C Hamano <hidden>
Date: 2026-02-04 23:26:15

"Derrick Stolee via GitGitGadget" [off-list ref] writes:
+static struct command commands[] = {
+	/* unknown_command must be last. */
+	{
+		.name = "",
+		.fn   = unknown_command,
+	},
+};
A useful trick is to deliberately omit the trailing comma after the
element that MUST be last.  You did that for the __NR enum element
in a later step.
+#define COMMAND_COUNT ((size_t)(sizeof(commands) / sizeof(*commands)))
Isn't this ARRAY_SIZE(commands)?

+	while (!(res = process_command(repo)));
Please write an empty statement on its own line, i.e.

	while (!(res = process_command(repo)))
		;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help