git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Johannes Sixt <j.sixt@viscovery.net>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Yaroslav Halchenko <debian@onerussian.com>,
	Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH v3 1/5] parse-options: Allow PARSE_OPT_NOARG in integer arguments
Date: Fri, 20 Aug 2010 12:49:51 -0700	[thread overview]
Message-ID: <7vlj81awtc.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1282331702-5115-2-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Sat\, 21 Aug 2010 00\:44\:58 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> When the option parser encounters an OPTION_INTEGER argument,
> PARSE_OPT_NOARG should imply that the default value should be used.

Sorry but why?

Doesn't NOARG mean "Do not take an argument, if you give me an argument
that is an error"?

I would understand if this were OPT_OPTARG, though.

Confused...

>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> Cc: Jakub Narebski <jnareb@gmail.com>
> ---
>  parse-options.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index e0c3641..7ec9886 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -138,6 +138,9 @@ static int get_value(struct parse_opt_ctx_t *p,
>  			*(int *)opt->value = 0;
>  			return 0;
>  		}
> +		if (opt->flags & PARSE_OPT_NOARG)
> +			*(int *)opt->value = opt->defval;
> +			return 0;
>  		if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
>  			*(int *)opt->value = opt->defval;
>  			return 0;
> -- 
> 1.7.2.2.409.gdbb11.dirty

  reply	other threads:[~2010-08-20 19:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 19:14 [PATCH v3 0/5] fmt-merge-msg improvements Ramkumar Ramachandra
2010-08-20 19:14 ` [PATCH v3 1/5] parse-options: Allow PARSE_OPT_NOARG in integer arguments Ramkumar Ramachandra
2010-08-20 19:49   ` Junio C Hamano [this message]
2010-08-20 20:01     ` Ramkumar Ramachandra
2010-08-21  3:39       ` Jonathan Nieder
2010-08-20 19:14 ` [PATCH v3 2/5] fmt-merge-msg: Make the number of log entries in commit message configurable Ramkumar Ramachandra
2010-08-21  3:54   ` Jonathan Nieder
2010-08-21  5:55     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 3/5] fmt-merge-msg: Update command line options to sync with config options Ramkumar Ramachandra
2010-08-21  4:02   ` Jonathan Nieder
2010-08-21  5:51     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 4/5] fmt-merge-msg: Remove deprecated --summary option Ramkumar Ramachandra
2010-08-21  4:04   ` Jonathan Nieder
2010-08-21  5:49     ` Ramkumar Ramachandra
2010-08-20 19:15 ` [PATCH v3 5/5] fmt-merge-msg: Update fmt-merge-msg and merge-config documentation Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vlj81awtc.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=debian@onerussian.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=jnareb@gmail.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).