Re: [PATCH v6 05/13] git.c: convert --list-* to --list-cmds=*

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

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> Even if these are hidden options, let's make them a bit more generic
> since we're introducing more listing types shortly. The code is
> structured to allow combining multiple listing types together because
> we will soon add more types the 'builtins'.
>
> 'parseopt' remains separate because it has separate (SPC) to match
> git-completion.bash needs and will not combine with others.
> ---

Missing sign-off.

> +static int list_cmds(const char *spec)
> +{
> +	while (*spec) {
> +		const char *sep = strchrnul(spec, ',');
> +		int len = sep - spec;
> +
> +		if (len == 8 && !strncmp(spec, "builtins", 8))
> +			list_builtins(0, '\n');

This is the origin of ugliness we see in later steps that follow the
same

	if (len == strlen(constS) && !strncmp(spec, constS, strlen(constS))

pattern added here.  Could we have a small helper that takes len,
spec, and constS to abstract "8" away?



[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