# [PATCH] help: Add a missing OPT_END().

3 messages from 2008-04-02 to 2008-04-02. Participants: Christian Couder, Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/12958

## Jeff King, 2008-04-02 03:44

Subject: Re: [PATCH] help: Add a missing OPT_END().
Message-ID: <20080402034430.GA10360@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20080402034430.GA10360%40coredump.intra.peff.net
In-Reply-To: <20080402054741.24d95299.chriscool@tuxfamily.org>

```
On Wed, Apr 02, 2008 at 05:47:41AM +0200, Christian Couder wrote:

> 	Some comments in "parse-options.h" say it is needed,
> 	though I did not see a crash without it.

There was no particular reason I didn't put it in; I just didn't know
about it. So ack from me, assuming it is supposed to be there.

-Peff

```

## Christian Couder, 2008-04-02 03:47

Subject: [PATCH] help: Add a missing OPT_END().
Message-ID: <20080402054741.24d95299.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/20080402054741.24d95299.chriscool%40tuxfamily.org

```
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 help.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

	Some comments in "parse-options.h" say it is needed,
	though I did not see a crash without it.

diff --git a/help.c b/help.c
index ecaca77..10298fb 100644
--- a/help.c
+++ b/help.c
@@ -30,6 +30,7 @@ static struct option builtin_help_options[] = {
 			HELP_FORMAT_WEB),
 	OPT_SET_INT('i', "info", &help_format, "show info page",
 			HELP_FORMAT_INFO),
+	OPT_END(),
 };
 
 static const char * const builtin_help_usage[] = {
-- 
1.5.5.rc2.6.gf58d

```

## Junio C Hamano, 2008-04-02 04:34

Subject: Re: [PATCH] help: Add a missing OPT_END().
Message-ID: <7vk5jgan9e.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk5jgan9e.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080402034430.GA10360@coredump.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> On Wed, Apr 02, 2008 at 05:47:41AM +0200, Christian Couder wrote:
>
>> 	Some comments in "parse-options.h" say it is needed,
>> 	though I did not see a crash without it.
>
> There was no particular reason I didn't put it in; I just didn't know
> about it. So ack from me, assuming it is supposed to be there.

parse-options.c::parse_short_opt() and parse_long_opt() has this loop:

	for (; options->type != OPTION_END; options++) {
		...
	}

So whatever happens to come after builtin_help_options[] may be read from
by this loop when you do not have OPTION_END.

```
