Re: [PATCHv13 28/30] builtin-notes: Add -c/-C options for reusing notes
- From
Stephen Boyd <bebarino@gmail.com>
- Date
- Feb 15, 2010, 10:34 UTC
- Message-ID
- <4B792347.8070208@gmail.com>
- In-Reply-To
- <1266096518-2104-29-git-send-email-johan@herland.net>
On 02/13/2010 01:28 PM, Johan Herland wrote:
Show 14 quoted lines
> @@ -199,6 +203,40 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset)
> return 0;
> }
>
> +static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
> +{
> + struct msg_arg *msg = opt->value;
> + char *buf;
> + unsigned char object[20];
> + enum object_type type;
> + unsigned long len;
> +
> + if (!arg)
> + return -1;This is impossible unless you're using the PARSE_OPT_OPTARG flag or allowing negation (i.e. --no-reuse-mesage). You should probably make the two callback options PARSE_OPT_NONEG and then drop this if statement. Same applies to some of the other callbacks not introduced in this patch.
> + > + if (msg->buf.len) > + strbuf_addstr(&(msg->buf), "\n"); > +
Use strbuf_addch()? I saw this in a couple other patches too.