Re: [PATCH 17/18] revert: Introduce --continue to continue the operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 01 August 2011 20:07:04 Ramkumar Ramachandra wrote:
> +static void verify_opt_mutually_compatible(const char *me, ...)
> +{
> +	const char *opt1, *opt2;
> +	va_list ap;
> +	int set;
> +
> +	va_start(ap, me);
> +	while ((opt1 = va_arg(ap, const char *))) {
> +		set = va_arg(ap, int);
> +		if (set)
> +			break;
> +	}
> +	if (!opt1)
> +		goto ok;
> +	while ((opt2 = va_arg(ap, const char *))) {
> +		set = va_arg(ap, int);
> +		if (set) {
> +			va_end(ap);
> +			die(_("%s: %s cannot be used with %s"),
> +				me, opt1, opt2);
> +		}
> +	}
> +ok:
> +	va_end(ap);
> +}

I'd suggest something like this:

static void verify_opt_mutually_compatible(const char *me, ...)
{
	const char *opt1, *opt2;
	va_list ap;

	va_start(ap, me);
	while ((opt1 = va_arg(ap, const char *))) {
		int set = va_arg(ap, int);
		if (set)
			break;
	}
	if (opt1) {
		while ((opt2 = va_arg(ap, const char *))) {
			int set = va_arg(ap, int);
			if (set)
				break;
		}
	}
	va_end(ap);

	if (opt1 && opt2)
		die(_("%s: %s cannot be used with %s"), me, opt1, opt2);
}

Thanks,
Christian.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]