Re: [PATCH v2 4/7] config: add --fixed-value option, un-implemented

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

 



"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> +	if (fixed_value) {
> +		int allowed_usage = 0;
> +
> +		switch (actions) {
> +		case ACTION_GET:
> +		case ACTION_GET_ALL:
> +		case ACTION_GET_REGEXP:
> +		case ACTION_UNSET:
> +		case ACTION_UNSET_ALL:
> +			allowed_usage = argc > 1 && !!argv[1];
> +			break;
> +
> +		case ACTION_SET_ALL:
> +		case ACTION_REPLACE_ALL:
> +			allowed_usage = argc > 2 && !!argv[2];
> +			break;

Implicitly all other ops do not want to work with the --fixed-value
option, which makes sense.

> +		}
> +
> +		if (!allowed_usage) {
> +			error(_("--fixed-value only applies with 'value_regex'"));
> +			usage_builtin_config();
> +		}
> +	}

I was afraid that abandoning the bitmask based approach of the
previous round may bloat the code but seeing the result here makes
me quite happy ;-)  It is quite clear what is going on.

Nice.



[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]

  Powered by Linux